the gridview column header takes the value like this from code behind protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { GridView grid = sender as GridView; DataRowView tableData = e.Row.DataItem as DataRowView;
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[1].Text = System.DateTime.Now.AddMonths(-3).ToString("MMMM") ;
}
}
How do I sort this particular column from code behind. file.asp
<asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="Bottom" ItemStyle-Wrap="False">
<ItemTemplate>
<asp:Label ID="lblMonth_1" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Thanks.