This is a migrated thread and some comments may be shown as answers.
Loding ascx into RadAjaxPanel then postback
1 Answer 47 Views
This is a migrated thread and some comments may be shown as answers.
ric c
Top achievements
Rank 1
ric c asked on 25 Aug 2009, 09:05 PM
Hi,
I have a masterpage which loads the following ascx. Within this ascx I have an action on a RadTreeNode that when clicked loads another ascx control into the RadAjaxPanel.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="RadTreeView1">  
            <UpdatedControls>                  
                <telerik:AjaxUpdatedControl ControlID="PnlSiteContent" /> 
                <telerik:AjaxUpdatedControl ControlID="LitMsg" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
        <telerik:AjaxSetting AjaxControlID="PnlSiteContent">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="PnlSiteContent" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting>          
    </AjaxSettings> 
</telerik:RadAjaxManager> 
<div style="float: left">  
    <div style="float: left; border: solid 1px #ccc; padding-right:10px;">  
        <telerik:RadTreeView ID="RadTreeView1" runat="server" OnNodeClick="RadTreeView1_NodeClick">      
</telerik:RadTreeView> 
    </div> 
    <div style="float: left; border: solid 0px #ccc; width:700px; padding-left:10px;">  
        <asp:Literal ID="LitMsg" runat="server"></asp:Literal> 
        <telerik:RadAjaxPanel ID="PnlSiteContent" runat="server">  
        </telerik:RadAjaxPanel> 
    </div> 
</div> 
protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)  
        {  
            LitMsg.Text = e.Node.Value;  
            Control cTest = LoadControl("CMTest.ascx");  
            PnlSiteContent.Controls.Add(cTest);  
        } 

Clicking on the tree node loads the "CMTest.ascx" (source below) into the panel fine. I have a button on my CMTest.ascx, when pressed, the ascx disappears from the RadAjaxPanel
<h1> 
<asp:Literal ID="LitMsg" runat="server"></asp:Literal> 
</h1> 
<asp:TextBox ID="Tb" runat="server"></asp:TextBox><asp:Button ID="Btn" runat="server" Text="Click" OnClick="Btn_Click" /> 
protected void Btn_Click(object sender, EventArgs e)  
        {  
            LitMsg.Text = "You entered: " + Tb.Text;  
        } 

Can anyone see what I'm doing wrong?

Many thanks!

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 28 Aug 2009, 09:41 AM
Hi,

Please review the below help topics on how to ajaxify controls wrapped in RadAjaxPanel and added to AJAX Manager settings and for more information on how to load controls with ajax:
http://www.telerik.com/help/aspnet-ajax/ajxcontrolsinajaxpanelandajaxsettings.html
http://www.telerik.com/help/aspnet-ajax/ajxloadusercontrols.html

Try following the steps described there and see if it works for you.

Best wishes,
Iana
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
ric c
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or