Column Sorting Problem

3 posts, 0 answers
  1. Ash
    Ash avatar
    8 posts
    Member since:
    May 2008

    Posted 06 May 2008 Link to this post

    I have a Radgrid on my page:


    telerik:RadGrid ID="RadGrid1" OnColumnCreated="RadGrid1_ColumnCreated" runat="server" style="text-align: left" AutoGenerateColumns="False" GridLines="None">


    <RowIndicatorColumn Visible="False">

    <HeaderStyle Width="20px" />


    <ExpandCollapseColumn Resizable="False" Visible="False">

    <HeaderStyle Width="20px" />



    <PopUpSettings ScrollBars="None" />



    <telerik:GridBoundColumn DataField="SKU" HeaderText="SKU"

    UniqueName="gcolumn1" >


    <telerik:GridBoundColumn DataField="Description" HeaderText="Description"

    UniqueName="gcolumn2" >


    <telerik:GridBoundColumn DataField="Orig Qty" HeaderText="Orig Qty"

    UniqueName="gcolumn3" >


    <telerik:GridBoundColumn DataField="Shiped Qty" HeaderText="Shiped Qty"

    UniqueName="gcolumn4" >





    I want to allow sorting for just my first column. but code is not working.

    Protected Sub RadGrid1_ColumnCreated(ByVal sender As Object, ByVal e As GridColumnCreatedEventArgs) Handles RadGrid1.ColumnCreated

    If TypeOf e.Column Is GridHyperLinkColumn Then

    Dim col As GridHyperLinkColumn = DirectCast(e.Column, GridHyperLinkColumn)

    If col.UniqueName = "gcolumn1" Then

    col.SortExpression =


    End If

    End If

    End Sub

  2. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 06 May 2008 Link to this post

    Ayesha, first, the ColumnCreated event is raised for auto-generated columns only, hence it will not fire in your case. Second, the first column in your grid is GridBoundColumn, not GridHyperLinkColumn. See the column types here. Third, to allow sorting set AllowSorting=true in the RadGrid tag. Last, set AllowSorting=false for all declarative columns but the first and you will be done.

  3. DevCraft R3 2016 release webinar banner
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 May 2008 Link to this post

    Hi Ash,

    You can have a look at the following help article to get information on setting sorting for GridHyperLinkColumn.
    Sorting for GridHyperLinkColumn/GridTemplateColumn

Back to Top