J
Jason
I have a dataadapter that fills a dataset in an asp.net web application. A
DataGrid then pulls data from a dataview whose source is the dataset. All
of this works great.
When I click on 'edit' in the datagrid it returns the proper record (proper
primary key value of the record I'm editing). However, if I sort the
datagrid (via the built-in sorting headers) then click on 'edit' it returns
the original record, not the record now in the sorted place in the datagrid.
That is, if I have a datagrid displaying:
ID Name
================
9 George
3 Jane
6 Harry
and click on any ID it returns the proper index (ie. 9 or 3 or 6) --This is
working as it should. If I sort the data however,(by clicking on 'ID') and
get
ID Name
================
3 Jane
6 Harry
9 George
and click on '3' I always get ID=9 back which is the orginal value of that
index.
I'm sorting the data through a dataview with the following code:
Private Sub DataGrid1_SortCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles
DataGrid1.SortCommand
dvwParam.Sort = e.SortExpression
DataGrid1.DataSource = dvwParam
DataGrid1.DataBind()
End Sub
and when the a specific ID is click I'm getting that value by:
Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
DataGrid1.EditCommand
'This is the value of the cell(1) a.k.a. ID in the datagrid
propChange_ID = CType(e.Item.Cells(1).Text, String)
End Sub
Am I missing a critical step to sync the dataview with the underlying
datagrid somehow? I'm performing a databind as shown in my Sort command so
I'm completely at a loss as to what's wrong with my code. Yes, I am
desparate at this point.
Thanks for any and all help in this.
Jay
DataGrid then pulls data from a dataview whose source is the dataset. All
of this works great.
When I click on 'edit' in the datagrid it returns the proper record (proper
primary key value of the record I'm editing). However, if I sort the
datagrid (via the built-in sorting headers) then click on 'edit' it returns
the original record, not the record now in the sorted place in the datagrid.
That is, if I have a datagrid displaying:
ID Name
================
9 George
3 Jane
6 Harry
and click on any ID it returns the proper index (ie. 9 or 3 or 6) --This is
working as it should. If I sort the data however,(by clicking on 'ID') and
get
ID Name
================
3 Jane
6 Harry
9 George
and click on '3' I always get ID=9 back which is the orginal value of that
index.
I'm sorting the data through a dataview with the following code:
Private Sub DataGrid1_SortCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles
DataGrid1.SortCommand
dvwParam.Sort = e.SortExpression
DataGrid1.DataSource = dvwParam
DataGrid1.DataBind()
End Sub
and when the a specific ID is click I'm getting that value by:
Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
DataGrid1.EditCommand
'This is the value of the cell(1) a.k.a. ID in the datagrid
propChange_ID = CType(e.Item.Cells(1).Text, String)
End Sub
Am I missing a critical step to sync the dataview with the underlying
datagrid somehow? I'm performing a databind as shown in my Sort command so
I'm completely at a loss as to what's wrong with my code. Yes, I am
desparate at this point.
Thanks for any and all help in this.
Jay