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

Dynamic control not working properly with radajax manager

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

I have created a really basic page with a panel that contains some content and a dynamically created link button. When the link button is clicked the panel is updated. The update is supposed to be done by a partial postback using the radajaxmanager but, for reasons I don't understand, every other time the link button is clicked a full postback is performed rather than a partial postback. In other words i get one partial postback then one full postback and so on.

I have reduced the page to its bare bones below. Please can you tell me how I fix this.

<%

@ Register Assembly="AspMapNET" Namespace="AspMap.Web" TagPrefix="cc1" %>

 

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

<!

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<

 

html xmlns="http://www.w3.org/1999/xhtml" >

 

<

 

head runat="server">

 

 

<title>Untitled Page</title>

 

 

</

 

head>

 

<

 

body>

 

 

<form id="form1" runat="server">

 

 

 

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

 

 

</asp:ScriptManager>

 

 

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

 

 

</telerik:RadAjaxManager>

 

 

&nbsp;

 

 

<asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px">

 

 

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

 

 

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

 

 

</asp:Panel>

 

 

 

 

 

</form>

 

</

 

body>

 

</

 

html>


 

Partial

 

Class Default2

 

 

Inherits System.Web.UI.Page

 

 

 

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

 

 

Dim l As New LinkButton

 

l.Text =

"link button"

 

 

 

 

 

AddHandler l.Click, AddressOf LinkButton_Click

 

PlaceHolder1.Controls.Add(l)

RadAjaxManager1.AjaxSettings.AddAjaxSetting(l, Panel1)

 

 

End Sub

 

 

 

 

 

Protected Sub LinkButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)

 

Label1.Text = Now()

 

End Sub

 

End

 

Class

 

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 22 Jun 2009, 01:39 PM
Hello Andieje,

Try setting ID of the Label control before adding it to Controls  collection of the place holder.
This should help.

All the best,
Nikolay
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
Nikolay Rusev
Telerik team
Share this question
or