Showing posts with label messagebox. Show all posts
Showing posts with label messagebox. Show all posts

Wednesday, March 21, 2012

updatePanel and MessageBox(alert)

Hi,

I have a button inside an UpdatePanel,, I want to show an alert box,,, How can I do that,, ??

I tried yo write this cose in the Button Click Event

string jv ="<script>alert('Hello');</script>";this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"msg", jv,false);

but nothing happened!!

thanks,,

You have to use the ScriptManager class to register an asynchronous javascript block. To make things easier, I'd also let ASP create the script tags; if you have more than one script to register, it will put them all in one set of tags.

string jv ="alert('Hello');";ScriptManager.RegisterClientScriptBlock(myControl, myControl.GetType(),"msg", jv,true);

Do it via ScriptManager

string jv ="<script>alert('Hello');</script>";ScriptManager.RegisterClientScriptBlock(this,typeof(Page),"alert", jv,false);

YesBig Smile

I am happy,, thanks very much,,