0
我要驗證在我的網頁兩個文本框,我想顯示在消息框中的驗證消息。我想在新行中顯示這兩個驗證消息。 我不喜歡這樣的:顯示在新行的驗證消息在MessageBox:
ErrorMsg="";
if (TextBox1.Text == "")
{
ErrorMsg += "Name is required!";
ErrorMsg += "\n";
}
if (TextBox2.Text == "")
{
ErrorMsg += "Address is required!";
}
ScriptManager.RegisterClientScriptBlock(this.Page, typeof(UpdatePanel), Guid.NewGuid().ToString(), "window.alert('" + ErrorMsg + "')", true);
return;
但它並不顯示消息框。
如果刪除了編碼線 ERRORMSG + = 「\ n」 個; 在上面的代碼。它只是連接兩個字符串並顯示消息框。
如何換行顯示?
t向你致敬。它的工作很好... – thevan