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.

1 Answer 1

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());
3
  • 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, 2011 at 7:33
  • ClientScript.RegisterStartupScript(this.GetType(), "My alert", "alert('" Your time has been finished "');", true); System.Text.StringBuilder sds = new System.Text.StringBuilder(); sds.Append("<script language='javascript'>"); sds.Append("window.location='localhost:49882/cybus/Home.aspx/'"); sds.Append("/script"); Type tr = this.GetType(); ClientScript.RegisterClientScriptBlock(tr,"PopupScript2",sds.ToString()); I added this code but i got java script runtime error that is :-Microsoft JScript runtime error: ASP.NET Ajax client-side framework failed to load
    – user949914
    Sep 17, 2011 at 8:39
  • this piece of code is working fine for me . or else you can check this link for more help: stackoverflow.com/questions/3695351/…
    – Pranav
    Sep 17, 2011 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.