The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi,
I have a gridDataBoundGrid wired to a gridFilterBar. To ensure that the comboboxes on the filterbar are sorted when clicked on, I have the following code:
for(int i = 0; i < grid.Model.ColCount; i++)
{
DataTable dt = grid[1, i].DataSource as DataTable;
if(dt != null)
{
string sortString = dt.Columns[0].ColumnName + " ASC";
dt.DefaultView.Sort = sortString;
}
}
The reason I need this code is because as rows are being added/deleted from the grid I update the filterbar combobox models are described in:
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=19224
This works fine as long as the DataType for the columns these comboboxes are being used on are strings. I have some columns that are ints but when the values are added to the combobox model they are being added as strings and then the combo box is not sorted numerically. I can''t change the dataType as the (none) value needs to be displayed. Is there anyway I can get the combobox to sort numerically?
Regards,
Matt
ADAdministrator Syncfusion Team November 8, 2004 09:10 AM UTC
I do not know of a simple way to do this.
One possibilty is to add an extra column of typeof(int) to the combobox datatable. Then move the ints from your ''real'' column to this extra column. For the (none) and (custom) entires add some well-chosen int values that will put them in the correct places in your int sort order. Then sort the DataTable based on this extra hidden column.