本文介绍了如何在ASP.NET中显示消息框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在成功保存任何项目时显示一个消息框.我用谷歌搜索并尝试了不同的解决方案,但没有一个起作用.这是我正在使用的代码:
I want to show a message box on the successful save of any item. I googled it and tried different solutions, but none of them worked. Here is the code I am using:
try { con.Open(); string pass="abc"; cmd = new SqlCommand("insert into register values('" + txtName.Text + "','" + txtEmail.Text + "','" + txtPhoneNumber.Text + "','" + ddlUserType.SelectedText + "','" + pass + "')", con); cmd.ExecuteNonQuery(); con.Close(); Response.Write("<script LANGUAGE='JavaScript' >alert('Login Successful')</script>"); } catch (Exception ex) { } finally { con.Close(); }(如果需要的话,我正在使用Firefox)
(I am using Firefox, if that matters)
推荐答案@freelancer如果您使用的是ScriptManager,请尝试使用此代码获取消息.
@freelancer If you are using ScriptManager then try this code for message..
string script = "alert(\"Hello!\");"; ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);更多推荐
如何在ASP.NET中显示消息框?
发布评论