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

[Solved] RadAjax manager and dynamically added controls

1 Answer 206 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
andieje
Top achievements
Rank 1
andieje asked on 22 Jun 2009, 11:18 PM
Hi

I need to add some hyperlinks to a page dynamically that trigger an synchonous postback using

javascript:__doPostBack


and the radajax manager. I reduced the page to its most simplest form but i can't get it to work - the page performs a full postback when the link is clicked

I have created a panel that contains a placeholder. I am adding a hyperlink dynamically to the placeholder. The href property of the hyperlink is a javascript doPostback call. I have set up the RadAjax manager so that the pnl is the ajaxified control and the updated control is the pnl but this did not work - a full postback was performed (my thinking here was that is i set the pnl as the ajaxified control then any control within the panel such as my dynamically link that triggers a postback will lead to an asynchronous update of the panel itself). I also tried adding the dynamically created hyperlinks to the ajax manager in the code behind but that didn't work either. Please can you advise what I need to do.

many thanks

 

<asp:ScriptManager ID="ScriptManager1" runat="server">

 

 

</asp:ScriptManager>

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

 

 

<AjaxSettings>

 

 

<telerik:AjaxSetting AjaxControlID="pnlTest">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="pnlTest" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

</AjaxSettings>

 

 

</telerik:RadAjaxManager>

 

 

<br />

 

 

<br />

 

 

<asp:panel ID="pnlTest" runat="server">

 

 

<asp:PlaceHolder runat="server" ID="ph1"></asp:PlaceHolder>

 

 

<br />

 

 

 

<br />

 

 

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

 

 

 

</asp:panel>

in page load event

 

 

Dim h As New HyperLink

 

h.NavigateUrl =

"javascript:__doPostBack('x','y')"

 

 

 

 

 

 

 

 

 

 

ph1.Controls.Add(h)

RadAjaxManager1.AjaxSettings.AddAjaxSetting(h, pnlTest)

label1.text = now()

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 25 Jun 2009, 02:49 PM
Hi andieje,

Please try setting the HyperLink Id to "x" and see if it works this way.

Note that the first argument of the _doPostBack() method should be the UniqueID of the control initiated the postback.

I hope this helps.

Sincerely yours,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Ajax
Asked by
andieje
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or