Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Navigate Enity by GridView
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01169653
Message ID:
01169726
Views:
8
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform