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

javascript doesn't fire on asynch postback

1 Answer 67 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
cognos s
Top achievements
Rank 1
cognos s asked on 30 Oct 2009, 07:55 PM
I do have a radgrid and a panel which has bunch of controls in it, one of which is a dropdown control.
when I select a record from the grid the panel controls are pre-populated with corresponding data.

when the dropdown list value is "other" i would like to execute javacript function.

I ajaxified the grid and the panel like this:

 

<telerik:RadAjaxManagerProxy ID="mpPatientPolicy" runat="server">

 

 

<AjaxSettings>

 

 

<telerik:AjaxSetting AjaxControlID="rgStudents">

 

 

    <UpdatedControls>

 

 

        <telerik:AjaxUpdatedControl ControlID="rgstudents" LoadingPanelID="AjaxLoadingPanel" />

 

 

        <telerik:AjaxUpdatedControl ControlID="pnlstudents" LoadingPanelID="AjaxLoadingPanel" />

 

 

     </UpdatedControls>

 

 

</telerik:AjaxSetting>
</ajaxsettings>
</telerik:radajaxmanagerproxy>

and I execute the javascript function like this.

 

Page.ClientScript.RegisterStartupScript(Page.GetType(), "key", "<script>hideElement();</script>"). the javascript is not getting fired.

Should I be using 

 

scriptManager.RegisterStartupScript to fire the javascript on async postback and what is the correct syntax?

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 03 Nov 2009, 05:59 PM
Hello Cognos,

In order to achieve the desired functionality you need to use ScriptManager instead ScriptManager.RegisterStartupScript(.....).
For more information, please take a look at this blog post.

I hope this helps.

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Ajax
Asked by
cognos s
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or