Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
Below is my code to display a popup

Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "script", "alert('Record Successfuly saved');", true);


i am getting a error "
VB
Error   12  An object reference is required for the non-static field, method, or property 'System.Web.UI.Page.ClientScript.get' 


could you please guide what to do?


Thanks
Posted

Hi,

Try this instead of above...
C#
Page.ClientScript.RegisterStartupScript(GetType(), "script","alert('Record Successfuly saved');", true);


Pleased don't forget to vote if help...

Regards,
 
Share this answer
 
Comments
Lancy.net 18-Nov-11 22:16pm    
thanks
Rubaba 3-Dec-11 11:45am    
good call.5*
 
Share this answer
 
Comments
Rubaba 3-Dec-11 11:45am    
nice links.5*
Monjurul Habib 3-Dec-11 13:03pm    
thank you Rubaba.
replace this with

Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "script", "alert('Record Successfuly saved');", true);


this
Page.ClientScript.RegisterStartupScript(this.GetType(), "aa", "<script language='javascript'>alert('Record Successfuly saved');</script>");
 
Share this answer
 
instead of typeof(page) use Page.GetType() and try
 
Share this answer
 
Page.ClientScript.RegisterStartupScript
(this.Gettype(),"Hello","alert('Hello Guys');",true);

try above code u won't get this error
 
Share this answer
 
v4

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