GridView Problems
Hi All,
I am working on GridView.
I used sorting on two columns ASC/DESC alternatively, as usually it is done.
Everything works fine but After changing the Sorting order GridView Displays the desired order but on GVMaterialMaster_SelectedIndexChanging Event,
Code:
protected void GVMaterialMaster_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
GridViewRow row = GVMaterialMaster.Rows[e.NewSelectedIndex];
string materialCode = row.Cells[0].Text;
}
the row.Cells[0].Text always have value of row.Cells[0] of GridView before Sorting. Means row.Cells[0] always have the same value whether sorting is changed or not
Example: GridView's first Row's first cell has value 'A' and Last Row's first cell has value 'X'
Now after sorting GridView is showing first Row's first Cell's value 'X' and Last Row's first cell has value 'A'. Its fine.
Now I Select First Row so It Shold show value of row.Cells[0] as 'X' but It is showing value of row.Cells[0] as 'A'.
I used DataView (creating views runtime according to GridView's DataSource). So Any Idea how to get row.Cells[0] in desird order?
Thanks in Advance.
Bajrang
|