1

I need to create a popup window that shows an error stored in a string variable from the code behind of an ASP site without using Jquery or Ajax. How can I make this work? I believe it has to do with ScriptManager but I am unsure...

Al Woods
  • 113
  • 1
  • 3
  • 11
  • You might want to also try this. http://stackoverflow.com/questions/25220746/a-modal-popup-with-out-using-ajax-update-panel-jquery-or-javascript-surprisin – Shankar Aug 10 '14 at 20:01

3 Answers3

0

Use RegisterStartupScript

string errorMessageString = "Error Here";
ScriptManager.RegisterStartupScript(this, this.GetType(), "UniqeKey", string.format("alert('{0}');", errorMessageString), true);
Cheruvian
  • 5,628
  • 1
  • 24
  • 34
0

You can use PopUpControl in an ASP.net AJAX extender. Below should help

<ajaxToolkit:PopupControlExtender ID="PopEx" runat="server"  
TargetControlID="DateTextBox"  
PopupControlID="Panel1"  
Position="Bottom" />
Sudheej
  • 1,873
  • 6
  • 30
  • 57
0

What I ended up doing is writing a function that has an error message returned from sql as an out statement, and then using ClientScript.RegisterStartupScript instead of the ScriptManager.

ClientScript.RegisterStartupScript(GetType(), "failed", string.Format("alert({0});", AntiXss.JavaScriptEncode(error)), true);
Al Woods
  • 113
  • 1
  • 3
  • 11