Click here to Skip to main content
15,917,174 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Guys!!!!!


i have following code


C#
ClientScript.RegisterClientScriptBlock(GetType(), "showSaveMessage", "<script language='JavaScript'> alert('USER Deleted Sucessfully' ); </script>");



is not working if im using master page...

and its working when master page is not using!


then please tell me what should i do if i am using master page.

thanx...
ChetanV
Posted
Updated 22-Dec-11 1:51am
v2
Comments
sriman.ch 22-Dec-11 0:47am    
Before or after this are you using any response.redirect.....?

Try ScriptManager.RegisterstartupScript....
[no name] 22-Dec-11 0:55am    
yup after validating it will redirected to home or main page..
[no name] 22-Dec-11 0:57am    
it working man when we not redirect to the any other page
problem solved......

thank u very much...
sriman.ch 22-Dec-11 6:21am    
Mark it as solved then....

Problem is not because of the masterpage
The code writes to output instructions for browser to show alert message. But this output will never be sent to the client, because next line instructs your web application to send this client response with code 302 and address to which the user must be redirected instead.
You should use Javascript to perform redirect from the client. The code would look like this:

Response.Write("<script>alert('my message'); ");
Response.Write("window.location='[new address]'</script>");
 
Share this answer
 
v2
try in the following way:
Page.ClientScript.RegisterStartupScript(this.GetType(), "showSaveMessage", "<script language='javascript'>alert('USER Deleted Sucessfully');</script>");


this worked for me
 
Share this answer
 
Hi, use below code to show alert, it runs properly.

ScriptManager.RegisterStartupScript(this, this.GetType(), "@#$", "alert('No Items mapped with selected Party');", true);

Any doubt then tell me.
 
Share this answer
 
problem solved .......
when we are not redirect to any other page then its working.

thank u very much.
 
Share this answer
 
Comments
Rajesh Anuhya 22-Dec-11 6:23am    
Post your comments under the related question/answer, not here.
Hi
VB
Before or after this are you using any response.redirect.....?
Try ScriptManager.RegisterstartupScript....



If you want to redirect to another page then after alert write window.open or window.location ....
 
Share this answer
 
v2

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