or
<telerik:RadAjaxLoadingPanel ID="MyLoadingPanel" runat="server" InitialDelayTime="0"> <asp:Image ID="MyImage" runat="server" ImageUrl="~/images/icons/loading.gif" /></telerik:RadAjaxLoadingPanel><telerik:AjaxSetting AjaxControlID="MyImage"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="MyRepeater" /> <telerik:AjaxUpdatedControl ControlID="MyLinkButton" LoadingPanelID="MyLoadingPanel"/> </UpdatedControls></telerik:AjaxSetting>protected void grProjects_NeedDataSource(object sender, GridNeedDataSourceEventArgs e){ if (!e.IsFromDetailTable) { this.grProjects.DataSource = (from c in new DataContext().Projects select c).ToArray(); }}protected void grProjects_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e){ if (e.DetailTableView.Name == "Images") { GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem; e.DetailTableView.DataSource = ((Project)dataItem.DataItem).ProjectItems; }}<telerik:RadGrid runat="server" ID="grProjects" OnNeedDataSource="grProjects_NeedDataSource" Skin="Windows7" AutoGenerateColumns="false" ShowFooter="false" OnItemDataBound="grProjects_ItemDataBound" OnItemCommand="grProjects_ItemCommand" OnDetailTableDataBind="grProjects_DetailTableDataBind"> <MasterTableView DataKeyNames="Id" CommandItemDisplay="Top" CommandItemStyle-Height="30px" ItemStyle-VerticalAlign="Top" AlternatingItemStyle-VerticalAlign="Top" HierarchyDefaultExpanded="false" HierarchyLoadMode="Client"> <CommandItemTemplate> <input type="button" class="rgAdd" onclick="javascript:addItem();" style="margin-left: 10px;" /><a href="javascript:;" onclick="javascript:addItem();">Add Project</a> </CommandItemTemplate> <Columns> <telerik:GridTemplateColumn ItemStyle-Width="20px" ItemStyle-Wrap="false"> <ItemTemplate> <asp:Button runat="server" ID="cmEdit" Text="Edit" CssClass="rgEdit" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn HeaderText="Name" DataField="Name" ItemStyle-Width="125px" /> <telerik:GridBoundColumn HeaderText="Description" DataField="Description" /> <telerik:GridButtonColumn ButtonType="ImageButton" HeaderStyle-Width="20px" ItemStyle-Width="20px" CommandName="Delete" ConfirmDialogType="RadWindow" ConfirmText="Are you sure you wish to permanently remove this project?<br /><br /><strong>All images contained inside will be removed as well and this action is not reversible.</strong>" /> </Columns> <DetailTables> <telerik:GridTableView Name="Images" DataKeyNames="Id" CommandItemDisplay="Top" CommandItemStyle-Height="30px" ItemStyle-VerticalAlign="Top" AlternatingItemStyle-VerticalAlign="Top" Width="100%"> <CommandItemTemplate> <asp:Button runat="server" ID="cmAddItem" CssClass="rgAdd" style="margin-left: 10px;" /><asp:HyperLink runat="server" ID="lkAddItem" Text="Add Image" NavigateUrl="javascript:;" /> </CommandItemTemplate> <Columns> <telerik:GridTemplateColumn ItemStyle-Width="20px" ItemStyle-Wrap="false"> <ItemTemplate> <asp:Button runat="server" ID="cmEdit" Text="Edit" CssClass="rgEdit" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Image" ItemStyle-Width="100px"> <ItemTemplate> <asp:Image runat="server" ImageUrl='<%# GetImageUrl(Eval("ImageName")) %>' /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Caption"> <ItemTemplate> <%#(Eval("Caption") != null) ? Eval("Caption").ToString().Replace("\r\n", "<br />") : string.Empty %> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridButtonColumn ButtonType="ImageButton" HeaderStyle-Width="20px" ItemStyle-Width="20px" CommandName="Delete" ConfirmDialogType="RadWindow" ConfirmText="Are you sure you wish to permanently remove this item?<br /><br /><strong>This action is not reversible.</strong>" /> </Columns> </telerik:GridTableView> </DetailTables> </MasterTableView></telerik:RadGrid> <telerik:RadGrid ID="grdBrokers" runat="server" AutoGenerateColumns="False" AllowSorting="True" AllowPaging="True" OnNeedDataSource="grdBrokers_NeedDataSource" AllowFilteringByColumn="True" EnableLinqExpressions="False"
OnDetailTableDataBind="grdBrokers_DetailTableDataBind" Skin="Office2007"> <MasterTableView CommandItemDisplay="Top" DataKeyNames="BrokerOfficeID" Height="100%" > <PagerStyle Mode="NextPrevAndNumeric" Position="Bottom" /> <HeaderStyle HorizontalAlign="Center" /> <RowIndicatorColumn> <HeaderStyle Width="20px" HorizontalAlign="Center" /> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px" HorizontalAlign="Center" /> </ExpandCollapseColumn> <DetailTables> <telerik:GridTableView DataKeyNames="BrokerContactID" Name="BrokerContacts" Width="100%" AllowFilteringByColumn="false" CommandItemDisplay="Top"> <Columns> <telerik:GridBoundColumn SortExpression="BrokerOfficeID" HeaderText="Office ID" HeaderButtonType="TextButton" DataField="BrokerOfficeID" UniqueName="BrokerOfficeID" AllowFiltering="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn SortExpression="BrokerContactID" HeaderText="Contact ID" HeaderButtonType="TextButton" DataField="BrokerContactID" UniqueName="BrokerContactID" AllowFiltering="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn SortExpression="Name" HeaderText="Contact Name" HeaderButtonType="TextButton" DataField="Name" UniqueName="Name" AllowFiltering="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn SortExpression="Email" HeaderText="Email" HeaderButtonType="TextButton" DataField="Email" UniqueName="Email" AllowFiltering="false"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn AllowFiltering="false" HeaderText="Edit" UniqueName="TemplateEditColumn"> <HeaderStyle Width="30px" HorizontalAlign="Center" /> <ItemStyle Width="30px" HorizontalAlign="Center" /> <ItemTemplate> <a href="#" onclick="ShowEditBrokerContactForm('<%# DataBinder.Eval(Container.DataItem, "BrokerOfficeID") %>','<%# DataBinder.Eval(Container.DataItem, "BrokerContactID") %>');"><img id="Img1" alt="" src ="~/App_Themes/Images/edit.gif" runat="server" border="0" /></a> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> <CommandItemTemplate> <a href="#" onclick="return ShowInsertBrokerContactForm('<%# get id of parent row here %>);">Add New Broker Contact</a> </CommandItemTemplate> </telerik:GridTableView> </DetailTables> <Columns> <telerik:GridBoundColumn HeaderText="ID" DataField="BrokerOfficeID" FilterControlWidth="30px" SortExpression="BrokerOfficeID" UniqueName="BrokerOfficeID" HeaderButtonType="TextButton"> <HeaderStyle Width="30px" /> <ItemStyle Width="30px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn HeaderText="Broker Office" DataField="Name" FilterControlWidth="300px" SortExpression="Name" UniqueName="Name" HeaderButtonType="TextButton"> <HeaderStyle Width="300px" /> <ItemStyle Width="300px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn HeaderText="Company Code" DataField="CompanyCode" FilterControlWidth="35px" SortExpression="CompanyCode" UniqueName="CompanyCode" HeaderButtonType="TextButton"> <HeaderStyle Width="35px" /> <ItemStyle Width="35px" /> </telerik:GridBoundColumn> <telerik:GridTemplateColumn AllowFiltering="false" HeaderText="Edit" UniqueName="TemplateEditColumn"> <HeaderStyle Width="30px" HorizontalAlign="Center" /> <ItemStyle Width="30px" HorizontalAlign="Center" /> <ItemTemplate> <a href="#" onclick="ShowEditBrokerForm('<%# DataBinder.Eval(Container.DataItem, "BrokerOfficeID") %>');"><img alt="" src ="~/App_Themes/Images/edit.gif" runat="server" border="0"></a> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> <CommandItemTemplate> <a href="#" onclick="return ShowInsertBrokerForm();">Add New Broker</a> </CommandItemTemplate> </MasterTableView> <ClientSettings AllowExpandCollapse="true" > </ClientSettings> <GroupingSettings CaseSensitive="false" /> </telerik:RadGrid> </telerik:RadPageView>function ShowEditBrokerContactForm(id1,id2) { window.radopen("EditBrokerContact.aspx?BrokerOfficeID=" + id1 + "&BrokerContactID=" + id2, "UserListDialog"); return false; } function ShowInsertBrokerContactForm(id) { window.radopen("EditBrokerContact.aspx?BrokerOfficeID=" + id, "UserListDialog"); return false; }