如何在服务器端的警报框中显示错误消息? [英] How can I show an error msg in an alert box on the server side?
本文介绍了如何在服务器端的警报框中显示错误消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
try
{
dbquery.getconnection(txtsname.Text, txtuname.Text, txtpwd.Text);
pnlDB.Visible = true;
pnlCN.Visible = true;
ddlDB();
}
catch (Exception ex)
{
lblex.Visible = true;
string p = ex.Message.ToString();
lblex.Text = p;
pnlDB.Visible = false;
pnlCN.Visible = true;
}
如何在服务器端的警报框中显示捕获错误?
How can I show the catch error in an alert box on the server side?
推荐答案
Try
http://www.dnzone.com/go?813 [ http://www.c-sharpcorner.com/UploadFile/mahesh/WebMsgBox09082006110110AM/WebMsgBox.aspx [ ^ ]
Try
http://www.dnzone.com/go?813[^]
http://www.c-sharpcorner.com/UploadFile/mahesh/WebMsgBox09082006110929AM/WebMsgBox.aspx[^]
我建议您记录错误,而不是在服务器端显示消息框.
检查 google [
I would suggest you to log the errors instead of showing message box at serverside.
Check the google[^] links to know more.
我认为您忘记了单引号在警报方法中的消息字符串周围,
Response.Write("<script language=''javascript''>alert(''" + p + "'')</script>");
I think you forgot the single quotes around the message string in alert method,
Response.Write("<script language=''javascript''>alert(''" + p + "'')</script>");
这篇关于如何在服务器端的警报框中显示错误消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文