Show Messege Box Using Button Control
Source Code
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnA" runat="server" onclick="btnA_Click"
style="font-weight: 700" Text="HAI" Width="138px" />
</div>
</form>
</body>
C# Code
protected void btnA_Click(object sender, EventArgs e)
{
Response.Write("<script>alert('Hai...')</script>"); //print message as script
}
Above Code Same As.....
<asp:Button ID="btnA" runat="server" onclick="btnA_Click"
style="font-weight: 700" Text="HAI" Width="138px" OnClientClick='return alert("Hai")' />
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnA" runat="server" onclick="btnA_Click"
style="font-weight: 700" Text="HAI" Width="138px" />
</div>
</form>
</body>
C# Code
protected void btnA_Click(object sender, EventArgs e)
{
Response.Write("<script>alert('Hai...')</script>"); //print message as script
}
Above Code Same As.....
<asp:Button ID="btnA" runat="server" onclick="btnA_Click"
style="font-weight: 700" Text="HAI" Width="138px" OnClientClick='return alert("Hai")' />
No comments:
Post a Comment