且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

不使用Page.ClientScript.RegisterStartupScript()和ScriptManager.regist .....在asp.net c#中显示消息框。

更新时间:2022-10-23 11:26:20

试试这个

 ClientScript.RegisterStartupScript( typeof (页面),  MessagePopUp  alert('按摩'); true ); 


ScriptManager.RegisterClientScriptBlock(this,this.GetType(),VariableRegisteration,strScript,true);



如果在更新面板内验证


试试这个



 ScriptManager.RegisterStartupScript( this  this  .GetType(),  script  alert('Message'); true ); 


hi I use these scripts for showing error msg.Scripts call proprly but msg not show in any browser..
here is scripts..

ClientScript.RegisterStartupScript(Page.GetType(), "fghh", "alert('Check Min% data, Min1% + Min2% + Min3% + Min4%  has to be equal to 100.');", true);

 ScriptManager.RegisterStartupScript(txt_Min4_Per, Page.GetType(), "", "alert('Check Min% data, Min1% + Min2% + Min3% + Min4%  has to be equal to 100.');", true);


how to solve this....

try this
ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "alert('Your Massage');", true);


ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "VariableRegisteration", strScript, true);

use this if ur validation inside update panel


Try this

ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Message');", true);