Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Navigate Enity by GridView
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01169653
Message ID:
01169726
Vues:
7
Ted,

>How do I return the edited DataRow of a GridView then use that datarow to navigate to the entity row for a webform?

In the RowUpdating event handler method, the EditIndex value specifies the DataRow in the DataTable that is being updated. You can do something like this:
protected void grdSurveyDue_RowUpdating(object sender, GridViewUpdateEventArgs e)
{

        // Get the item to be updated
        this.grdSurveyDue.EditIndex = e.RowIndex;
        // Retrieve the previous SurveyDue DataSet
        DataSet dsSurveyDue = (DataSet)Session["dsSurveyDue"];
        // Get the DataRow
        DataRow CurrentRow = dsSurveyDue.Tables["MyTableName"].Rows[e.RowIndex];

        // Use the below to set the entity data row
        this.oSurveyDue.Entity.SetDataRow(CurrentRow);

        // NOTE: Put code in here to check and manipulate the data

         // Save the DataSet (the GridView automatically binds back)
        this.Save(this.oSurveyDue, dsSurveyDue);

        // Reset the edited item and rebind the GridView
        this.grdSurveyDue.EditIndex = -1;
        this.BindControl(this.grdSurveyDue);
}
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform