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

I'm using details table on radgrid.Row select is not working for details table only when i set HierarchyLoadMode="ServerOnDemand".

1 Answer 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
thees
Top achievements
Rank 1
thees asked on 28 Oct 2010, 11:33 AM
I'm using details table on radgrid.Row select is not working for details table only when i set HierarchyLoadMode="ServerOnDemand".Please Help me to out of this.
<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" OnNeedDataSource="RadGrid1_NeedDataSource"
                        OnDetailTableDataBind="RadGrid1_2Bind" OnItemDataBound="RadGrid1_OnDataBound" OnPreRender="RadGrid1_OnPreRender"
                    <HeaderStyle CssClass="RadGridHeader" />
                    <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true"/>
                    <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                        <ClientEvents  OnRowDblClick="RowDblClicked"  />
                        <Selecting AllowRowSelect="True"  />
                    </ClientSettings>
                    <MasterTableView  AutoGenerateColumns="False"  HierarchyLoadMode="ServerOnDemand" ShowHeadersWhenNoRecords="false" NoDetailRecordsText="">
                        <CommandItemSettings ExportToPdfText="Export to Pdf" ShowAddNewRecordButton="False"
                            ShowExportToExcelButton="True" ShowExportToPdfButton="True" ShowExportToWordButton="True"
                            ShowRefreshButton="False" />
                             
                            <DetailTables>
                                <telerik:GridTableView runat="server"  Name="RedGrid_2"   
                                    AllowPaging="true" AutoGenerateColumns="False" NoMasterRecordsText="" PageSize="10" Width="100%">
                                    <Columns>
                                        <telerik:GridBoundColumn SortExpression="SupplierName" HeaderText="Supplier Name"
                                            DataField="SupplierName"
                                        <telerik:GridTemplateColumn  HeaderText="DM" SortExpression="DMetrix" DataType="System.String"
                                        UniqueName="DM" ItemStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                           <a><%# ((Int32)(DataBinder.Eval(Container.DataItem, "DMetrix")) == -2) ? ("--") : DataBinder.Eval(Container.DataItem, "DMetrix")%></a>
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridTemplateColumn>                                                                         
                                    </Columns>
                                </telerik:GridTableView>
                            </DetailTables>
             
                        <Columns>
                            <telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID"
                                UniqueName="ID"  Visible="false">
                            </telerik:GridBoundColumn
<%--                            <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name"
                                UniqueName="Name" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                            </telerik:GridBoundColumn>--%> 
                            <telerik:GridTemplateColumn HeaderText="" UniqueName="UpANDDown" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                                <itemtemplate>
                                    <asp:ImageButton ID="btnUp" runat="server" OnClick="btnUp_Click" ImageUrl="images/UP_Arrow_Icon.png" CommandName="UP" />
                                    <asp:ImageButton ID="btnDown" runat="server" OnClick="btnDown_Click" ImageUrl="images/DOWN_Arrow_Icon.png" CommandName="DOWN"/>
                                </itemtemplate>
                                <itemstyle horizontalalign="Center"></itemstyle>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Field Quota" SortExpression="FieldQuota"
                                UniqueName="FieldQuota" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:TextBox ID="tbFieldQuota" runat="server" Text='<%# Bind("FieldQuota") %>' ToolTip="Enter Numeric Value"
                                            Width="50px" MaxLength="5" OnTextChanged="UpdateFieldQuotaInGrid" AutoPostBack="true"></asp:TextBox>  
                                </ItemTemplate>
                            </telerik:GridTemplateColumn
  
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Order" HeaderText="Order"
                                UniqueName="IsLock" Visible="false">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                     
                </telerik:RadGrid>
                </ContentTemplate>
                

protected void RadGrid1_2Bind(object source, GridDetailTableDataBindEventArgs e)
        {
           
            try
            {
                GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
                if (e.DetailTableView.Name == " RadGrid1_2Bind")
                {
                    string parentHedgeRemaining = dataItem["ID"].Text;
                     
                        DataTable dt = GetDatatabe();
                        e.DetailTableView.DataSource = dt;
                    
                }
                else
                {
                    e.DetailTableView.DataSource = null;
                }
            }
            catch (Exception ex)
            {
            }
        }

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 02 Nov 2010, 01:28 PM
Hello thees,

Can you elaborate a bit more on what is not working when the hierarchy load mode is ServerOnDemand? I followed your steps and prepared a sample project attached to this post and rows selection is working find on my side.

All the best,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
thees
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or