Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete Row from Many Side of Relationship
Message
De
05/08/2010 11:33:14
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Delete Row from Many Side of Relationship
Divers
Thread ID:
01475325
Message ID:
01475325
Vues:
101
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform