by: Saravanan Arumugam
Page views:
3237


We often get requirement that we have to show alert message or display any message from code behind. Following code is used to show alert message from server side or code behind.

protected void btnSubmit_Click(object sender, EventArgs e)

{

string Message = "Welcome to dotnetfox.!!";

ScriptManager.RegisterStartupScript(Page, this.GetType(), "Key",

string.Format("alert('{0}');", Message), true);

}

ScriptManager.RegisterStartupScript method is used to register the startup script with the page object.

Parameters

type

Type: System.Type
The type of the startup script to register.

key
Type: System.String
The key of the startup script to register.

script
Type: System.String
The startup script literal to register.

addScriptTags
Type: System.Boolean
A Boolean value indicating whether to add script tags.

Please subscribe, if you want to get email updates (it's free).



Comments
comments powered by Disqus
Subscribe via Email
    
message to display in fancybox