0

how can i get Response of OK button message box in client page.

ClientScript.RegisterStartupScript(this.GetType(), "My alert", "alert('" Your time has been finished "');", true);

this code is working in simple way means without getting any response.

Jordan
  • 31,971
  • 6
  • 56
  • 67
user949914
  • 221
  • 1
  • 4
  • 9

1 Answers1

1

you can directly start your further activity in next line . on click of OK button it will return to your next line .

//your code goes here... //for example:-

     ClientScript.RegisterStartupScript(this.GetType(), "My alert", "alert('" Your time has been finished "');", true);
    System.Text.StringBuilder sbs = new System.Text.StringBuilder();
    sbs.Append("<script language='javascript'>");
    sbs.Append("window.location = 'http://www.google.com/'");//or whatever you want:-
    sbs.Append("</script>");
    Type tr = this.GetType();
    ClientScript.RegisterClientScriptBlock(tr, "PopupScript2", sbs.ToString());
Pranav
  • 8,563
  • 4
  • 26
  • 42
  • But i want redirect the page after pressing ok button is it possible in javascript sbs.Append("Response.Redirect("Home.aspx")"); its not working.. Now what to do.. – user949914 Sep 17 '11 at 07:33
  • ClientScript.RegisterStartupScript(this.GetType(), "My alert", "alert('" Your time has been finished "');", true); System.Text.StringBuilder sds = new System.Text.StringBuilder(); sds.Append(" – user949914 Sep 17 '11 at 08:39
  • this piece of code is working fine for me . or else you can check this link for more help: http://stackoverflow.com/questions/3695351/ajax-client-side-framework-failed-to-load-asp-net-4-0 – Pranav Sep 17 '11 at 09:15