This is a migrated thread and some comments may be shown as answers.

Executing Javascript

4 Answers 125 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Shane
Top achievements
Rank 1
Shane asked on 25 Sep 2007, 06:09 AM
Hi Guys

I am using User Control wrapped with an update panel. I using master page. When I click a button in the user control, it just update some details.
(One master page with a user control to display messages and a page with another user control)

My problem is, I have a user control in the master page which show the result if is successful, but this user control is not in the update panel.

I used a javascript function to display the message before. Now I have put the other user control inside a update panel.

My question is, how do I execute a javascript code when an operation is successful from code behind? Can I pass back parameter from code behind to update panel, so the update panel can execute javascript according to the result?


Cheers
Shane

4 Answers, 1 is accepted

Sort by
0
plamen
Top achievements
Rank 1
answered on 27 Sep 2007, 02:41 PM
hi

Shane, could you please try using the ResponseScripts property of your AjaxPanel

RadAjaxPanel1.ResponseScripts.Add("alert('hello script!');");

For more information on this property check out the ajax documentation

aLl ThE BeSt...
<John Pell />
0
Shane
Top achievements
Rank 1
answered on 27 Sep 2007, 11:04 PM
Hi John

The user controls is wrapped by RadAjaxPanel. I don't know how I can access the RadAjaxPanel from user control.

I need to fire up the Javascript  function from the event inside the user control.

Cheers
Shane
0
David Silveria
Top achievements
Rank 1
answered on 28 Sep 2007, 05:42 AM
You can setup a public property for the AjaxPanel and access it in your user control.

Cheers
0
Shane
Top achievements
Rank 1
answered on 28 Sep 2007, 07:37 AM
Thanks for help guys. I have achieved what I wanted.

Thanks again guys!

Cheers
Shane
Tags
Ajax
Asked by
Shane
Top achievements
Rank 1
Answers by
plamen
Top achievements
Rank 1
Shane
Top achievements
Rank 1
David Silveria
Top achievements
Rank 1
Share this question
or