Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 16, 2013 06:29 PM by DaBolander
Jan 16, 2013 05:41 PM|LINK
This is on the button Click event.
I even created a class for a Static Alert but that wont fire. I debugged and put a break on the line but it returns no error just steps right through it. Any thoughts?
Jan 16, 2013 05:46 PM|LINK
Try using this within your code-behind click event for your button :
protected void Button1_Click(object sender, EventArgs e)
ASPX Page Markup
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<asp:Button ID="Button1" runat="server" onclientclick="alert('Information has been saved!');" Text="Button" />
Jan 16, 2013 06:07 PM|LINK
The first mehtod you suplied, same problem it wont fire.
// Assembly References
public static class Alert
public static void Show(string message)
string cleanMessage = message.Replace("'", "\\'");
Page page = HttpContext.Current.CurrentHandler as Page;
if (page != null && !page.ClientScript.IsClientScriptBlockRegistered("alert"))
page.ClientScript.RegisterClientScriptBlock(typeof(Alert), "alert", script);
protected void btn1_OnClick(object sender, EventArgs e)
Alert.Show("Info has been saved");
Jan 16, 2013 06:11 PM|LINK
Try this line -
page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", script);
Hope it helps u...
Jan 16, 2013 06:29 PM|LINK