Server-side column selected event

3 posts, 0 answers
  1. Al
    Al avatar
    228 posts
    Member since:
    Oct 2006

    Posted 15 Jul 2015 Link to this post


    I have a grid where the user will click a column and I want to handle that column-click server-side. I tried handling OnSelectedCellChanged (with EnablePostBackOnRowClick="true") but that only works when clicking cells, not columns headers. How can I achieve this?

  2. Al
    Al avatar
    228 posts
    Member since:
    Oct 2006

    Posted 17 Jul 2015 in reply to Al Link to this post

     I have found a half-solution for this:


    The only thing is that now when clicking a cell the whole column is no longer selected ie. CellSelectionMode="Column"  seems to have no effect.

    What I want is that a whole column is selected when the user clicks the column header or any cell in that column and then do a postback - any ideas?

  3. Konstantin Dikov
    Konstantin Dikov avatar
    2466 posts

    Posted 20 Jul 2015 Link to this post

    Hello Al,

    If the selection stopped working after you have included those client settings, it is possible that there is a JavaScript error present on the page that breaks the functionality of the controls.

    Notwithstanding, for handling the header column click on server-side you can use the client-side OnColumnClick event and fire custom command through the grid's MasterTableView with the column's UniqueName:
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function grdRaw_OnColumnClick(sender, args) {
                sender.get_masterTableView().fireCommand("ColumnHeaderClick", args.get_gridColumn().get_uniqueName());
    <asp:Label runat="server" ID="Label1"></asp:Label>
    <telerik:RadGrid runat="server" ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand">
        <ClientSettings  ClientEvents-OnColumnClick="grdRaw_OnColumnClick"

    And the code-behind:
    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
        if (e.CommandName == "ColumnHeaderClick")
            var clickedColumnName = e.CommandArgument.ToString();
            Label1.Text = clickedColumnName;

    As for the Column CellSelectionMode, this property will select the cells for the entire column only when you click on the column's header. Detailed information on this matter is available in the following help article:

    Hope this helps.

    Konstantin Dikov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top