WebUserControl, UpadtePanel And JavaScript Problem
-
I have one WebUserControl, in that in have placed one UpdatePanel after that i have placed one Button. Finally I have placed that UserControl on my new WebForm. structure - WebUserControl -> Updatepanel ->Button and New WebForm->WebUserContol Now I want to show JavaScript alert window when i m pressing Button from code behind. fot that i have written- ScriptManager.RegisterStartupScript(this,typeof(this.getType()) ,"ScriptKey","alert('HI')", true); But it is not working.Plz help me . Thank's in advance.
-
I have one WebUserControl, in that in have placed one UpdatePanel after that i have placed one Button. Finally I have placed that UserControl on my new WebForm. structure - WebUserControl -> Updatepanel ->Button and New WebForm->WebUserContol Now I want to show JavaScript alert window when i m pressing Button from code behind. fot that i have written- ScriptManager.RegisterStartupScript(this,typeof(this.getType()) ,"ScriptKey","alert('HI')", true); But it is not working.Plz help me . Thank's in advance.
Not sure if you have figured it out yet, but I think the problem is where you register your startup script. It should point to the page (page where the control is loaded) and not to the control itself. You can try : ScriptManager.RegisterStartupScript(this.Page,typeof(this.Page.getType()) ,"ScriptKey","alert('HI')", true); Hope this helps.