i filled my gridView . Also give property sorting. but i need up down image sorting in progress. Click descending cssclass="sortdescheader". But i can not do that. How can i makie it? İ really used below codes. Please help me with below codes?
protected void gvProducts_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridView gridView = (GridView)sender;
if (gridView.SortExpression.Length > 0)
{
int cellIndex = -1;
foreach (DataControlField field in gridView.Columns)
{
if (field.SortExpression == gridView.SortExpression)
{
cellIndex = gridView.Columns.IndexOf(field);
break;
}
}
if (cellIndex > -1)
{
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[cellIndex].CssClass += (gridView.SortDirection == SortDirection.Ascending
? " sortascheader" : " sortdescheader");
}
else if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[cellIndex].CssClass += (e.Row.RowIndex % 2 == 0 ? " sortaltrow" : "sortrow");
}
}
}
}