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

Disabling "RowClick" for one column in a grid

3 Answers 755 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 2
Richard asked on 28 Jan 2010, 10:18 PM
I have set <ClientEvents OnRowClick="RowClick" /> to fire when a row is clicked.  I have a Server-side checkbox on the row that I would like to exclude from this javascript event.  Does anyone know if there is a way to do this and how?

Basically, I am trying to have a checkbox on the Grid row that when checked doesn't fire a server-side or client-side event.  When I click on a button on the page, I'd like to cycle through the grid and get the items with a checkmark.

Thanks!

 

3 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 01 Feb 2010, 11:05 AM
Hi Richard,

The RowClick event is not fired when you click on a control within a table cell in the grid. Am I missing something. Could you paste your aspx and code behind?

Thanks.

Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jesse
Top achievements
Rank 1
answered on 05 May 2019, 02:35 PM

Im having this same issue. Is there a solution for this? Basically I wan to disable the "rowclick" only for column on which contains a checkbox. I have delete button on the page that will operate on all check boxes....

<telerik:RadGrid ID="dgTransactions" runat="server" AllowPaging="True" AllowSorting="True" PageSize="200" Height="600px" AllowMultiRowSelection="true">
                    <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
                    <SortingSettings EnableSkinSortStyles="False"></SortingSettings>
                    <ClientSettings EnablePostBackOnRowClick="true">
                        <Selecting AllowRowSelect="True"  />
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                        <Resizing AllowColumnResize="True" AllowResizeToFit="True" />
                    </ClientSettings>
                    <MasterTableView AutoGenerateColumns="False" Width="100%" DataKeyNames="TransactionID" AllowSorting="True" AllowNaturalSort="False" >
                        <Columns>
                        
                            <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">
                                 <HeaderStyle HorizontalAlign="Center" Width="20px" />
                                <ItemStyle HorizontalAlign="Right"/>
                            </telerik:GridClientSelectColumn>
                                                       
                            <telerik:GridBoundColumn DataField="TransactionDate" DataFormatString="{0:MM/dd/yyyy}" FilterControlAltText="Filter DatePosted column" HeaderText="Entered" ItemStyle-HorizontalAlign="Right" ReadOnly="True" UniqueName="TransactionDate">
                                <HeaderStyle HorizontalAlign="Center" Width="80px" />
                                <ItemStyle HorizontalAlign="Right" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="FollowUpDate" DataFormatString="{0:MM/dd/yyyy}" FilterControlAltText="Filter DatePosted column" HeaderText="Follow Up" ItemStyle-HorizontalAlign="Right" ReadOnly="True" UniqueName="FollowUpDate">
                                <HeaderStyle HorizontalAlign="Center" Width="80px" />
                                <ItemStyle HorizontalAlign="Right" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ChargeAmount" DataFormatString="{0:c}" FilterControlAltText="Filter Subject column" HeaderText="Charge" ReadOnly="True" UniqueName="ChargeAmount" ItemStyle-HorizontalAlign="Right">
                                <HeaderStyle Width="45px" HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Right" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CreditAmount" DataFormatString="{0:c}" FilterControlAltText="Filter Subject column" HeaderText="Credit" ReadOnly="True" UniqueName="CreditAmount" ItemStyle-HorizontalAlign="Right">
                                <HeaderStyle Width="45px" HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Right" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="PostDate" DataFormatString="{0:MM/dd/yyyy}" FilterControlAltText="Filter DatePosted column" HeaderText="Post" ItemStyle-HorizontalAlign="Right" ReadOnly="True" UniqueName="PostDate">
                                <HeaderStyle HorizontalAlign="Center" Width="80px" />
                                <ItemStyle HorizontalAlign="Right" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Comment" FilterControlAltText="Filter Subject column" HeaderText="Comments" ReadOnly="True" UniqueName="Comment" AllowSorting="True"  HtmlEncode="true">
                                <HeaderStyle Width="250px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="UserInitials" FilterControlAltText="Filter Subject column" HeaderText="By" ReadOnly="True" UniqueName="UserInitials">
                                <HeaderStyle Width="35px" />
                            </telerik:GridBoundColumn>
                        </Columns>
                        <SortExpressions>
                            <telerik:GridSortExpression FieldName="TransactionDate" SortOrder="Descending" />
                        </SortExpressions>
                        <HeaderStyle Font-Bold="True" />
                    </MasterTableView>
                </telerik:RadGrid>

0
Vessy
Telerik team
answered on 09 May 2019, 06:56 AM
Hi Jesse,

You can check the content of the currently clicked cell in the OnRowSelecting event of the Grid and disable the click if the cell contains an input:
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/events/onrowselecting

For example, you can have a similar logic:
function onRowSelecting(sender, args) {
    var e = args.get_domEvent();
    var targetElement = e.srcElement || e.target || event.target;
    var input = targetElement.children[0];
 
    if (input && input.id.lastIndexOf("ClientSelectColumnSelectCheckBox") > 0) {
        args.set_cancel(true);
    }
}


Regards,
Vessy
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Richard
Top achievements
Rank 2
Answers by
Tsvetoslav
Telerik team
Jesse
Top achievements
Rank 1
Vessy
Telerik team
Share this question
or