|
 |
aspx thread: Deleting Records from DataGrid Not Working!!
Message #1 by comching@y... on Thu, 6 Feb 2003 08:30:48
|
|
Hi All,
I'm trying to delete a row from the DataGrid, which has data populated
from a xml document. The problem is this: I have loaded the data from the
xml into a DataView.table and then set the DataGrid's datasource to the
DataView. But somehow, that row being clicked "Delete" does not get
deleted away, but some other row did!! And I had a DataView.Sort called
before the DataGrid.DataSource, does this affect the index when it's
passed into DataView.Table.Rows.RemoveAt(e.Item.ItemIndex)??
Appreciate your help on the above!!
Message #2 by "Ashish M.bhonkiya" <Ashishm@p...> on Thu, 6 Feb 2003 14:01:26 +0530
|
|
can u send the code...
-----Original Message-----
From: comching@y... [mailto:comching@y...]
Sent: Thursday, February 06, 2003 2:01 PM
To: ASP.NET
Subject: [aspx] Deleting Records from DataGrid Not Working!!
Hi All,
I'm trying to delete a row from the DataGrid, which has data populated
from a xml document. The problem is this: I have loaded the data from the
xml into a DataView.table and then set the DataGrid's datasource to the
DataView. But somehow, that row being clicked "Delete" does not get
deleted away, but some other row did!! And I had a DataView.Sort called
before the DataGrid.DataSource, does this affect the index when it's
passed into DataView.Table.Rows.RemoveAt(e.Item.ItemIndex)??
Appreciate your help on the above!!
Message #3 by comching@y... on Thu, 6 Feb 2003 08:54:44
|
|
Hi,
Here's part of the code, the page_load and DataGrid_DeleteCommand, where
the data in the DataView is being sorted before databind() is called.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Session("AccountList") Is Nothing Then
ADataView.Table = CType(Session("AccountList"), DataTable)
ADataView.Sort = "Account_No, Account_Level"
DataGrid.DataSource = ADataView
End If
End Sub
.... other functions ....
Sub DataGrid_DeleteCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
DataGrid.DeleteCommand
ADataView.Table.Rows.RemoveAt(e.Item.ItemIndex)
Session("AccountList") = ADataView.Table
ADataView.Sort = "Account_No, Account_Level"
DataGrid.DataSource = ADataView
DataGrid.DataBind()
End Sub
Thanks alot!!
> can u send the code...
-----Original Message-----
From: comching@y... [mailto:comching@y...]
Sent: Thursday, February 06, 2003 2:01 PM
To: ASP.NET
Subject: [aspx] Deleting Records from DataGrid Not Working!!
Hi All,
I'm trying to delete a row from the DataGrid, which has data populated
from a xml document. The problem is this: I have loaded the data from the
xml into a DataView.table and then set the DataGrid's datasource to the
DataView. But somehow, that row being clicked "Delete" does not get
deleted away, but some other row did!! And I had a DataView.Sort called
before the DataGrid.DataSource, does this affect the index when it's
passed into DataView.Table.Rows.RemoveAt(e.Item.ItemIndex)??
Appreciate your help on the above!!
|
|
 |