Alert
message is nothing but alert when we are inserting or deleting before that we
need confirmation or else alert message for user guide in actually what we are
doing and what effect we comes after that. Here we will display alert message
through code behind.
Step 1: Drag Button
Control in Webpage.
<div>
<asp:Button ID="Button1"
runat="server"
Text="Click to
Show Alert Message" onclick="Button1_Click" />
</div>
Step 2: Generate
Click event and Code for Generate dynamically alert Message.
protected void Button1_Click(object
sender, EventArgs e)
{
string
Message = "Welcome to My WebSite.!!";
ScriptManager.RegisterStartupScript(Page,
this.GetType(), "Key",string.Format("alert('{0}');",
Message), true);
}
Now check in your
Browser and click on button to generate alert message.
Thanks for comments.....