Hello,
I have a RadGrid which is allowing row selections:
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="true"></Selecting>
</ClientSettings>
However, I also have a GridTemplateColumn in my RadGrid that contains a RadComboBox with a list of options. When the user selects an option in the RadComboBox, I do NOT want the row in the RadGrid to be selected. But if the user clicks in any other column of the RadGrid, then I'm fine with the row being selected, just not when the user clicks on the RadComboBox in the GridTemplateColumn.
Can you help with this?
Thanks!
I have a RadGrid which is allowing row selections:
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="true"></Selecting>
</ClientSettings>
However, I also have a GridTemplateColumn in my RadGrid that contains a RadComboBox with a list of options. When the user selects an option in the RadComboBox, I do NOT want the row in the RadGrid to be selected. But if the user clicks in any other column of the RadGrid, then I'm fine with the row being selected, just not when the user clicks on the RadComboBox in the GridTemplateColumn.
Can you help with this?
Thanks!
5 Answers, 1 is accepted
0
Jayesh Goyani
Top achievements
Rank 2
answered on 28 Feb 2014, 05:29 AM
Hello,
Let me know if any concern.
Thanks,
Jayesh Goyani
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script> function RowSelecting(sender, args) { if (args._domEvent.target.cellIndex == 2) { args.set_cancel(true); } } </script> </telerik:RadCodeBlock><MasterTableView DataKeyNames="ID" ClientDataKeyNames="ID" EnableHeaderContextMenu="true"> <Columns> <telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn UniqueName="templateColumn"> <ItemTemplate> <telerik:RadComboBox ID="RadComboBox1" runat="server"> <Items> <telerik:RadComboBoxItem Text="1" Value="1" /> <telerik:RadComboBoxItem Text="2" Value="2" /> </Items> </telerik:RadComboBox> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn> </Columns> </MasterTableView> <ClientSettings> <Selecting AllowRowSelect="true" /> <ClientEvents OnRowSelecting="RowSelecting" /> </ClientSettings>Let me know if any concern.
Thanks,
Jayesh Goyani
0
Jason
Top achievements
Rank 1
answered on 28 Feb 2014, 08:31 PM
Thanks Jayesh, that works exactly as expected.
However, I forgot to mention that I have "EnablePostBackOnRowClick" set to TRUE in the ClientSettings. I want this postback since there is additional information that is loaded on the page depending on the row selected in the RadGrid.
The result I'm hoping for, is for the user to be able to select a row in the RadGrid and it cause a postback, except for my custom GridTemplateColumn. When the user selects this custom column (or the dropdown inside of that column), I don't want there to be a postback from the row selection.
However, I forgot to mention that I have "EnablePostBackOnRowClick" set to TRUE in the ClientSettings. I want this postback since there is additional information that is loaded on the page depending on the row selected in the RadGrid.
The result I'm hoping for, is for the user to be able to select a row in the RadGrid and it cause a postback, except for my custom GridTemplateColumn. When the user selects this custom column (or the dropdown inside of that column), I don't want there to be a postback from the row selection.
Thanks!
Jason
0
Jayesh Goyani
Top achievements
Rank 2
answered on 01 Mar 2014, 06:35 AM
Hello,
There is not any Set_Cancel/PreventDefault method is available in RowClick event, So (as per my knowledge) we can not achieve this thing.
Thanks,
Jayesh Goyani
There is not any Set_Cancel/PreventDefault method is available in RowClick event, So (as per my knowledge) we can not achieve this thing.
Thanks,
Jayesh Goyani
0
Jason
Top achievements
Rank 1
answered on 02 Mar 2014, 01:44 AM
Ok, thank you Jayesh for taking the time to look into my question.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 02 Mar 2014, 07:30 AM
Hello,
You can achieve this thing indirectly by using AjaxManager - Client-side API or __dopostback.
Let me know if any concern.
Thanks,
Jayesh Goyani
You can achieve this thing indirectly by using AjaxManager - Client-side API or __dopostback.
Let me know if any concern.
Thanks,
Jayesh Goyani