hi
im having a grid as shown in the attachement. i need to sort the grid with the dataset in binding into the grid. im calling an sp for the dataset.
the code is :
i dont have any parameter called ASC/DESC to pass each time on sort command. pleas help me on this.
i used gridbound columns with above grid declaration and mastertable view.
the sorting command:
sort command tries sorting but its not refelcting any change in order in the grid, i cannot implement onneedsource since im using SP or dataset. please help, i think if i have onneeddatasource for the above senario, it will work. help me in coding onneeddata source for this.
im having a grid as shown in the attachement. i need to sort the grid with the dataset in binding into the grid. im calling an sp for the dataset.
the code is :
| objBizReport = new BizReport(); |
| DataSet dsReport = objBizReport.GetDeletedLeads(orgId, fromDate, toDate); |
| gvReport_Leads.DataSource = dsReport.Tables[2]; |
| gvReport_Leads.DataBind(); |
i dont have any parameter called ASC/DESC to pass each time on sort command. pleas help me on this.
| <telerik:RadGrid ID="gvReport_Leads" runat="server" CssClass="radgrid" AllowPaging="True" |
| EnableEmbeddedSkins="false" ShowFooter="false" AutoGenerateColumns="False" GridLines="None" |
| AllowSorting="True" Width="800 px" AllowMultiRowSelection="true" OnItemDataBound="gvReport_Leads_ItemDataBound" |
| OnSortCommand="gvReport_Leads_SortCommand"> |
| <MasterTableView CssClass="radgridMasterTable" AllowCustomSorting="true" Width="100%" |
| ShowHeadersWhenNoRecords="true" TableLayout="Fixed" ClientDataKeyNames="lead_id"> |
i used gridbound columns with above grid declaration and mastertable view.
the sorting command:
| protected void gvReport_Leads_SortCommand(object source, GridSortCommandEventArgs e) |
| { |
| GridSortExpression sortExpr = new GridSortExpression(); |
| switch (e.OldSortOrder) |
| { |
| case GridSortOrder.None: |
| sortExpr.FieldName = e.SortExpression; |
| sortExpr.SortOrder = GridSortOrder.Descending; |
| e.Item.OwnerTableView.SortExpressions.AddSortExpression(sortExpr); |
| break; |
| case GridSortOrder.Ascending: |
| sortExpr.FieldName = e.SortExpression; |
| sortExpr.SortOrder = gvReport_Leads.MasterTableView.AllowNaturalSort ? GridSortOrder.None : GridSortOrder.Descending; |
| e.Item.OwnerTableView.SortExpressions.AddSortExpression(sortExpr); |
| break; |
| case GridSortOrder.Descending: |
| sortExpr.FieldName = e.SortExpression; |
| sortExpr.SortOrder = GridSortOrder.Ascending; |
| e.Item.OwnerTableView.SortExpressions.AddSortExpression(sortExpr); |
| break; |
| } |
| e.Canceled = true; |
| gvReport_Leads.Rebind(); |