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

[Solved] ClientSelectColumn on Sub Grid

1 Answer 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 21 Mar 2013, 08:57 PM
I'm trying to created a grid hierarchy as outlined in this example. I'm using the DetailsTables method (as opposed to NestedViewTemplate) and I would like to put a GridClientSelectColumn on the sub-grid, allowing the user to select only one item from each sub-grid. When i set the parent's AllowMultiRowSelection="False", however, this causes all the sub-grid's to act as a single group, allowing the user to only select 1 item from ALL sub-grids. The definition for my grid is as follows

<telerik:RadGrid runat="server" ID="ledger" Width="900px" AllowSorting="true" AllowPaging="true" AutoGenerateColumns="false" PageSize="10" AllowFilteringByColumn="true" OnNeedDataSource="ledger_NeedDataSource" OnDetailTableDataBind="ledger_DetailTableDataBind" AllowMultiRowSelection="False">
  <GroupingSettings CaseSensitive="false" />
  <ClientSettings EnableRowHoverStyle="true" EnableAlternatingItems="true">
    <Selecting AllowRowSelect="True"  UseClientSelectColumnOnly="True"/>
  </ClientSettings>
  <MasterTableView DataKeyNames="SubstanceId, Name, CAS" ClientDataKeyNames="SubstanceId"  
        ShowHeadersWhenNoRecords="true" CommandItemDisplay="None" Font-Size="10">
    <DetailTables>
      <telerik:GridTableView runat="server" Name="SuggestedComponents" PageSize="5"
            AllowFilteringByColumn="False" AllowSorting="False" AutoGenerateColumns="False" ShowFooter="True">
        <Columns>
          <telerik:GridBoundColumn HeaderText="Name" UniqueName="SuggestionPrimaryName"
               DataType="System.String" AllowSorting="False" AllowFiltering="False" DataField="PrimaryName" />
          <telerik:GridBoundColumn HeaderText="CAS" UniqueName="SuggestionCAS" DataType="System.String"
                AllowSorting="False" AllowFiltering="False" DataField="CAS" />
          <telerik:GridClientSelectColumn UniqueName="SuggestionSelect" />
        </Columns>
      </telerik:GridTableView>
    </DetailTables>
    <Columns>
      <telerik:GridBoundColumn AllowSorting="true" DataType="System.String" UniqueName="SubstanceName"
            HeaderText="Name" DataField="Name" />
      <telerik:GridBoundColumn AllowSorting="true" DataType="System.String" UniqueName="CAS"
            HeaderText="CAS" DataField="CAS" />
      <telerik:GridBoundColumn AllowSorting="true" DataType="System.String" UniqueName="ProductCode"
            HeaderText="Product Code" DataField="ProductCode" />
      <telerik:GridBoundColumn AllowSorting="true" DataType="System.String" UniqueName="ClientSubstanceId"
            HeaderText="Client ID" DataField="ClientSubstanceId" />
    </Columns>
  </MasterTableView>
</telerik:RadGrid>

How can I achieve a single-select-per-sub-grid behavior?

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 26 Mar 2013, 02:43 PM
Hello Jeff,

I am afraid you have manually implement this functionality.  A possible solution is to check whether the table has a selected item and remove it from the SelectedItems collection. You could achieve that by hooking OnRowSelecting client side event.

Regards,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Jeff
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or