Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Newbie: No defaults saving data using datagrid
Message
De
20/08/2008 13:36:02
Ed Milner
National Care Connection
Colorado, États-Unis
 
 
À
20/08/2008 11:15:52
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 2.0
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01340081
Message ID:
01340431
Vues:
9
Here is the working btnAddEditor_Click... Based on Kevin's input, the problem was resolved by adding a NewBusinessEntity, instead of adding a NewRow. Now the entity defaults are picked up from the entities Default class. Pretty cool.
    protected void btnAddEditor_Click(object sender, EventArgs e)
    {
        // Retrieve the previous entity DataSet
        DataSet dsEditor = (DataSet)Session["dsEditor"];

        //Add a new entity to the business object instead of adding a row to the DataSet
        oEditor.NewBusinessEntity(this.oEditor.Defaults);
        //this.oEditor.NewRow(dsEditor, this.oEditor.TableName, new TblEditorDefaults(1, 1));

        // Set the ID of the creating user
        oEditor.DataRow.SetField("CreateUserID", 1);

        // Store the DataSet back into the session
        Session["dsEditor"] = dsEditor;

        // Set the new row for editing
        this.dgrdEditor.EditItemIndex = dsEditor.Tables[this.oEditor.TableName].Rows.Count - 1;

        // Rebind the GridView
        this.BindControl(this.dgrdEditor);
    }
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform