Reputation: 6967
is it possible to disable sorting on specific columns?
5 out of 7 columns have to be sortable, two not sortable. The columns are created dynamically in code behind, so I think doing this with mark up is out of the question.
When I say disabled, I'm hoping that the underline wont show on the column header when you mouse over it.
Any help apprciated.
Upvotes: 2
Views: 2050
Reputation: 97
Old problem, but I faced the same problem today. My fast solution is:
protected void GvTicketOnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[6].ToolTip = "Full Column Title";
e.Row.Cells[6].Controls.Clear();
e.Row.Cells[6].Text = "Column Title";
}
}
Upvotes: 0
Reputation: 15043
In your datagrid, each column has a sortexpression. If you have the sortexpression to be blank, those columns won't be sortable.
Upvotes: 1