Skip to main content Skip to footer

Disable Sorting on AutoGenerated Wijmo GridView Column

When C1GridView is bound to a datasource, the columns are auto generated. Disabling sorting on a particular column is difficult as there are no boundfields or templatefields specifically coded - its all AUTOgenerated. The easy way to disable sorting on Wijmo GridView column is to subscribe the DataBound event of the gridview and set the sort expression to nothing. The code looks like following :

protected void C1GridView1_DataBound(object sender, EventArgs e)  
{  
    foreach (C1.Web.Wijmo.Controls.C1GridView.C1BoundField item in C1GridView1.Columns)  
    {  
        if (item.HeaderText.Equals("Company"))  
        {  
            item.SortExpression = "";  
            return;  
        }  
    }  
}

Please refer to attached sample for the detailed implementation. Download Sample

MESCIUS inc.

comments powered by Disqus