Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in my application i need to get popup while client click save button...my code is
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "if (!AlertMessageBox ('Data Saved Successfully')){window.location.href='sysusermst.aspx?sm=" + osmId + "';}", true);

it works fine in mozilla but remaining other browsers i did not get popup..i dont know why?
Posted
Comments
[no name] 15-Dec-15 6:01am    
In other browser what is happening exactly?

Try with below code:

function AlertMessageBox (myForm) {
alert("before redirect..");
window.location.href = "http://localhost/temp.aspx?width=" + screen.width + "&height=" + screen.height;
return false;
}
User-11630313 15-Dec-15 6:16am    
in other browsers does not generate message pop up box
F-ES Sitecore 15-Dec-15 6:01am    
Is AlertMessageBox a plug-in you're using? If you use "confirm" does it work?

http://www.w3schools.com/jsref/met_win_confirm.asp
User-11630313 15-Dec-15 6:18am    
here i need to generate pop up box from code behind only...
Nathan Minier 15-Dec-15 7:24am    
Yeah, the format you used for the JS is basically a browser feature detect. AlertMessageBox is not a standard JS function, so it evaluates as undefined, and therefore false, for any browser that doesn't use that construct.

1 solution

As Nathan mentioned, that is not a built-in function JavaScript function so if you do not have a function named that it will not work.

You could just alert() or you could use jquery ui dialog as well if you want something nicer looking.
 
Share this answer
 
Comments
User-11630313 15-Dec-15 7:33am    
hey RyanDev..is there any way to get pop up in all browsers from code behind...
ZurdoDev 15-Dec-15 7:36am    
Yes, I just answered you. Use alert() or jquery Ui dialog or some other javascript dialog.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900