Disabling "RowClick" for one column in a grid

4 posts, 0 answers
  1. Richard
    Richard avatar
    63 posts
    Member since:
    Apr 2008

    Posted 28 Jan 2010 Link to this post

    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!

     

  2. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 01 Feb 2010 Link to this post

    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.
  3. Jesse
    Jesse avatar
    1 posts
    Member since:
    Apr 2018

    Posted 05 May in reply to Tsvetoslav Link to this post

    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>

  4. Vessy
    Admin
    Vessy avatar
    2068 posts

    Posted 09 May Link to this post

    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.
Back to Top