Hi
I have below Gridview with AutoGenerateColumns = True. I want to sort on Date column
<div class="table-responsive"> <%--OnRowEditing="OnRowEditing" OnRowCancelingEdit="OnRowCancelingEdit" OnRowUpdating="OnRowUpdating" AutoGenerateEditButton="true"--%> <asp:GridView ID="grdPlanning" class="table table-bordered" runat="server" OnRowDataBound="gr_RowDataBound" OnRowCommand="grdPlanning_RowCommand" DataKeyNames="BookID" AllowSorting="True"> </asp:GridView> </div>
DataTable BookPlanningResult = sQLUtility.GeBookPlanningRecommendation(vRpl, BookCollection, StudentCollection).Tables[0]; if (BookPlanningResult != null) { DataColumn Remarks = new DataColumn("Remarks", typeof(string)); BookPlanningResult.Columns.Add(Remarks); DataColumn Dates = new DataColumn("Date", typeof(DateTime)); BookPlanningResult.Columns.Add(Dates); grdPlanning.DataSource = BookPlanningResult; int lastColumnIndex = BookPlanningResult.Columns.Count - 1; grdPlanning.DataBind(); }
Thanks