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

Datalist inside Grid EditForm Template

1 Answer 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ruth Dahan
Top achievements
Rank 1
Ruth Dahan asked on 12 Feb 2009, 09:26 AM
Hi,
I have a grid which is edited in a pop up window (edit form). One field that is edited should be an inner data list, that can be added with editable rows. Trying to define an inner asp datalist leads to confusion between the edit commands on the grid and on the datalist.

What is the recommended way to design an inner editable list (or grid) like the one mentioned above and can be seen in this link?
edit user EditFrom

my code:
            <asp:DataList ID="AgentsDataList2" runat="server" DataSourceID="UserAgentsDatasource" 
                OnEditComman="DataList2_EditCommand" DataKeyField="UserId"
                <EditItemTemplate> 
                    <telerik:RadTextBox ID="tbdlAgentId" runat="server" Text='<%# Bind("AgentId") %>'
                    </telerik:RadTextBox> 
                    <telerik:RadComboBox ID="cmbdlSwitches" runat="server" DataSourceID="SwitchesDatasource" 
                        DataTextField="Value" DataValueField="Key" Skin="Office2007"
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                    </telerik:RadComboBox> 
                    <asp:LinkButton ID="LinkButton1" runat="server" CommandName="update"
                     
                    </asp:LinkButton> 
                    &nbsp; 
                    <asp:LinkButton ID="LinkButton2" runat="server" CommandName="cancel"
                     
                    </asp:LinkButton> 
                </EditItemTemplate> 
                <ItemTemplate> 
                    <asp:Label ID="lblAgentId" runat="server" Text='<%# Eval("AgentId") %>' /> 
                    &nbsp;&nbsp; 
                    <asp:Label ID="lblSwitches" runat="server" Text='<%# Eval("SwitchId") %>' /> 
                    &nbsp;&nbsp; 
                    <asp:LinkButton runat="server" ID="LinkButton1" CommandName="Edit"> Edit 
                    </asp:LinkButton> 
                </ItemTemplate> 
            </asp:DataList> 
        </telerik:RadPageView> 
    </telerik:RadMultiPage> 
     <script runat="server"
        protected void DataList2_EditCommand(object source, 
            DataListCommandEventArgs e) 
        { 
            //something here... 
            int x = e.Item.ItemIndex; 
        } 
 
       </script> 

Thanks in advanced,
Ruth




1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 16 Feb 2009, 03:20 PM
Hello Ruth,

There should be no confusion between the DataList events and the RadGrid events. This is achievable, because the ASP.NET page framework provides a technique called event bubbling that allows a child control to propagate events up to its containment hierarchy. So when DataList raise event, it will be bubbled after Grid's ItemCommand event is raised. Here you can find more information devoted on this subject.

The DataList logic can be implemented in the ItemCommand handler or in other specific handler. You can ajaxify the DataList to replace the regular postbacks with ajax requests instead.

Best regards,
Georgi Krustev
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
Grid
Asked by
Ruth Dahan
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or