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

Select RadGrid Row Client Side when RadComboBox gets focus

1 Answer 255 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 30 Jul 2010, 08:13 PM
I have a RadComboBox inside a GridTemplateColumn:

                        <telerik:RadGrid ID="rgrdTest" runat="server" Skin="Vista" Height="290px">
                            <MasterTableView AutoGenerateColumns="false">
                                <Columns>
                                    <telerik:GridTemplateColumn HeaderText="Action" UniqueName="Action">
                                        <ItemTemplate>
                                            <telerik:RadComboBox ID="rcbx" runat="server" Width="200px"
                                                DropDownWidth="300px" Skin="Vista" Height="100px">
                                            </telerik:RadComboBox>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                </Columns>
                            </MasterTableView>
                            <ClientSettings>
                                <Scrolling AllowScroll="true" />
                                <Selecting AllowRowSelect="true" />
                            </ClientSettings>
                        </telerik:RadGrid>

Can somebody show me how to select the Grid's row of the selected combobox when it takes focus via client-side? Preferably if this can be done using the OnClientFocus event of the combobox? So whenever someone clicks any of the combobox per row , the whole grid item row is selected. Thanks!

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Aug 2010, 06:10 AM
Hello Philip,

You can achieve this by attaching OnClientFocus event to RadComboBox. In the event handler find corresponding row index and select that particular row.

ASPX:
<telerik:RadComboBox ID="rcbx" OnClientFocus="OnFocus" runat="server" Width="200px"
      DropDownWidth="300px" Skin="Vista" Height="100px">
</telerik:RadComboBox>

Java Script:
<script type="text/javascript">
 function OnFocus(sender, args)
   {
      var rowIndex = sender.get_element().parentNode.parentNode.rowIndex - 1;
      var grid = $find("<%=rgrdTest.ClientID %>");
      var MasterTable = grid.get_masterTableView();
      MasterTable.get_dataItems()[rowIndex].set_selected(true);
    }
</script>

Thanks,
Princy.
Tags
Grid
Asked by
Philip
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or