Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete Row from Many Side of Relationship
Message
From
05/08/2010 11:33:14
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Delete Row from Many Side of Relationship
Miscellaneous
Thread ID:
01475325
Message ID:
01475325
Views:
100
Hi,

MM.NET, C#, ASP.NET

I have a form displaying a 1 to many relationship. The many side is displayed in a grid view and rows can be added/edited/deleted.

Currently I have code like this, that will delete the row in the grid:
        protected void grdRiders_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            DataSet dsPolicyRider = (DataSet)Session["dsPolicyRider"];
            dsPolicyRider.Tables[0].Rows[e.RowIndex].Delete();
            this.BindControl(this.grdRiders);
        }
When the row is deleted, it is removed from the display in the Grid View. However, when I then use the page's Save button, I get this error in VS2008:
Exception has been thrown by the target of an invocation.
If I stop the application, this error then gets displayed in the browser:
Deleted row information cannot be accessed through the row.
How does one delete rows from a grid successfully?

< update >
I just noticed that this error only occurs if I have two rows in the grid and I delete the first one. If I just have one row, or delete the last row, then it is fine.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Next
Reply
Map
View

Click here to load this message in the networking platform