To write a Scripts in server side in Asp.net we can use ScriptManager.RegisterStartupScript() method
If you give the script tag in the string s then give addScriptTags to false. ScriptManager is a class inside System.Web.UI .
As a result a alert box with 'hello' pops up, where you place this line.
ScriptManager.RegisterStartupScript(Control control,type type,string Key,string Script,bool addScriptTags)
Example:
string s = "alert('Hello')"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Hello", s, true);
|
No responses found. Be the first to respond and make money from revenue sharing program.
|