S
Sukanya
Guest
Hi,
I need this very badly.
I am using a datagridview for which the datasource is a dataview. This dataview is assigned with a datatable from database.
I am able to display the row numbers for the gridview by adding new column like shown below:
int rowcount = table1.Rows.Count;
table1.Columns.Add(new DataColumn("SNO", typeof(int)));
for (int i = 1; i <= rowcount; i++)
{
table1.Rows[i - 1]["SNO"] = i;
}
But main problem arised when i sort any another colum , the "SNO" also gets sorted with row numbers not in proper order. Like if I sort by name then row numbers are displyed like 3,2,1 ..
Even when i use Dataviews row filter, only few columns are displayed with previous rownumbers. Suppose, after row filter we are left with only last two columns, then the Row numbers are displayed as 2,3 but 1 is missing because it was filtered in rowfilter.
But I want 1,2 to be displayed there.
Please can any one help. Thanks in Advance,
Sukanya.
Continue reading...
I need this very badly.
I am using a datagridview for which the datasource is a dataview. This dataview is assigned with a datatable from database.
I am able to display the row numbers for the gridview by adding new column like shown below:
int rowcount = table1.Rows.Count;
table1.Columns.Add(new DataColumn("SNO", typeof(int)));
for (int i = 1; i <= rowcount; i++)
{
table1.Rows[i - 1]["SNO"] = i;
}
But main problem arised when i sort any another colum , the "SNO" also gets sorted with row numbers not in proper order. Like if I sort by name then row numbers are displyed like 3,2,1 ..
Even when i use Dataviews row filter, only few columns are displayed with previous rownumbers. Suppose, after row filter we are left with only last two columns, then the Row numbers are displayed as 2,3 but 1 is missing because it was filtered in rowfilter.
But I want 1,2 to be displayed there.
Please can any one help. Thanks in Advance,
Sukanya.
Continue reading...