I have Column which have data like digits and string together . But I need this to be sorted by digits. Once Click on column sorting the data From stored procedure is getting sorted as required. But after binding to grid the data in the column changes. Please help
Below is the column data
Looking forward for your reply.
Hello,
Could you please try to reproduce this issue in a separate sample in order to investigate it further for you.
Hi,
I have added the code suggested . I removed sorting then binded the data. But still IgGird doing it own sorting. Please check the below code
protected void dgBudgetApprovalAlerts_SortColumn(object sender, Infragistics.Web.UI.GridControls.SortingEventArgs e) { e.SortedColumns.Clear(); e.SortedColumns.Remove(e.SortedColumns[e.Column.Key]); string strOrder = string.Empty; if (PWWebHelper.GetWebSafeInt(CurrPageIndex.InnerText) == e.Column.Index) { if (PWWebHelper.GetWebSafeTrimmedString(hdnDBSortOrder.InnerText) == "ASC") strOrder = "DESC"; else strOrder = "ASC"; } else strOrder = "ASC"; for (int index = 0; index < dgBudgetApprovalAlerts.Behaviors.Sorting.SortedColumns.Count - 1; index++) { dgBudgetApprovalAlerts.Behaviors.Sorting.SortedColumns.Add(dgBudgetApprovalAlerts.Columns[e.Column.Index], Infragistics.Web.UI.SortDirection.None); }
if (strOrder == "ASC") { dgBudgetApprovalAlerts.Behaviors.Sorting.SortedColumns.Add(dgBudgetApprovalAlerts.Columns[e.Column.Index], Infragistics.Web.UI.SortDirection.Ascending); } else { dgBudgetApprovalAlerts.Behaviors.Sorting.SortedColumns.Add(dgBudgetApprovalAlerts.Columns[e.Column.Index], Infragistics.Web.UI.SortDirection.Descending); }
//hdnSortColumnNo.InnerText = e.Column.Index.ToString(); hdnSortColumn.InnerText = dgBudgetApprovalAlerts.Columns[e.Column.Index].Key; CurrPageIndex.InnerText = PWWebHelper.GetWebSafeTrimmedString(e.Column.Index); hdnDBSortOrder.InnerText = strOrder; BindData(m_SupplierKey); HighLightColumn(sender, e.Column.Index, hdnDBSortOrder.InnerText); }
Thank you for the detailed explanation. The reason our Grid to behave like that is because these values are considered as strings and the Grid sort them like strings, not integers. Possible solution would be to clear the sorted column and then do bind the customly sorted data, the Grid will not try to resort it by its string value.
For more information you can have a look at this forum thread where my colleague Michael explain in details this approach:
http://ko.infragistics.com/community/forums/t/80117.aspx
Related reference:
http://ko.infragistics.com/community/forums/t/83579.aspx
Hi Zdravko,
For example . Once I click the column on the grid for sorting the data in the TotalBudget fetching from Database by Stored procedure looks like :
TotalBudget
$22.00
$100.00
$354.00
$370.00
$2000.00
$15000.00 * 2 Activities
$20000.00
But When it binds to the grid the valuw displayed in the grid looks like
Hope this explains the issue . Please let me know for any queries.