Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie: No defaults saving data using datagrid
Message
From
20/08/2008 13:36:02
Ed Milner
National Care Connection
Colorado, United States
 
 
To
20/08/2008 11:15:52
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 2.0
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01340081
Message ID:
01340431
Views:
8
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);
    }
Previous
Reply
Map
View

Click here to load this message in the networking platform