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

Buttons with Dynamically loaded UserControls doesn't fire "Ajax" Postback

3 Answers 104 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Ricky
Top achievements
Rank 1
Ricky asked on 20 Feb 2008, 09:34 AM
Hi,
Scenario:
I dynamically (with RadAjaxManager) loaded a UserControl, called Uc1, where a UserControl, Uc2, resides within Grid's Template Column.
 Initially, the Grid is shown as follows:
 http://www.sendspace.com/file/i1pscp and when users click any LinkButton, the Uc1 belongging to that Column will be loaded as follows:
http://www.sendspace.com/file/c9oa0m

Problem:
The problem is clicking buttons within Red box will automatically fire ajax postbacks, while the button (within Uc2) in the Blue Box still raises normal postback. Why? How do I let buttons at Uc2 raise ajax postback as well?

For c# code implemention, I assign each GridDataItem to Ajaxify the Container Panel where Uc1 resides. And the markup of Container_Panel is at bottom.

    protected void MsgGrid_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (e.Item as GridDataItem);
       
            // Attach click event handler to Title_Btn
            LinkButton titleBtn = (LinkButton) item["ContentColumn"].FindControl("Title_Btn");
            titleBtn.Click += new EventHandler(TitleBtn_Clicked);

            // Set Ajax source and target
            Panel loadPanel = (Panel)item["ContentColumn"].FindControl("Container_Panel");
            RadAjaxManagerProxy1.AjaxSettings.AddAjaxSetting(item, loadPanel);
        }
    }

-------------------------------------------------------------------------------

<ItemTemplate>
                <asp:Panel ID="Container_Panel" runat="server">
                <div runat="server" class="headerPanel" >
                    <%--<asp:Label ID="Title_Lbl" runat="server" Text='<%# Eval("Title") %>'></asp:Label>--%>
                    <div style="width:400px;min-width: 400px;float:left;">
                    <asp:LinkButton ID="Title_Btn" runat="server" Text='<%# Eval("Title") %>' style="width:200px;min-width: 200px;color:Navy"></asp:LinkButton>
                    <asp:Label ID="SourceName_Lbl" runat="server"  style="width:150px" ></asp:Label> <%-- Bind at runtime--%></div>
                    <div style="text-align:right;float:right ">
                    <asp:Label ID="CreateTime_Lbl" runat="server" Text='<%# Eval("CreateTime", "{0:G}") %>' ></asp:Label>
</div>
                    </div>
                    <div runat="server" style="clear:both;height:0px;display:none" id="Loading_Panel_container">
                       
                    </div>
                    <dbwc:dynamiccontrolsplaceholder id="Loading_Panel" runat="server" ControlsWithoutIDs="DontPersist" ></dbwc:dynamiccontrolsplaceholder>

                </asp:Panel>
            </ItemTemplate>

Thanks for your help.
Ricky.

3 Answers, 1 is accepted

Sort by
0
Ricky
Top achievements
Rank 1
answered on 21 Feb 2008, 08:55 AM
This problem stems from my misunderstanding.

Sorry for the bothering.
Ricky.
0
Steve
Telerik team
answered on 22 Feb 2008, 03:45 PM
Hello Ricky,
 
Do you still need help with this or you've figured it out? You can drop a line with your solution in case somebody else encounters similar problems.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ricky
Top achievements
Rank 1
answered on 23 Feb 2008, 02:45 AM
In this case, RadAjaxManager works well, but it is me considering that I do not fire Ajax Call due to a server-side error.

Thanks,
Ricky.
Tags
Ajax
Asked by
Ricky
Top achievements
Rank 1
Answers by
Ricky
Top achievements
Rank 1
Steve
Telerik team
Share this question
or