Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Jump start: Any Add example
Message
 
To
28/02/2010 09:26:41
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01451594
Message ID:
01451602
Views:
41
Frank,

Here is what I do:

For each object I have in my app I have a list form which contains a grid of items I want to edit. For this example, I will use Client as my business object. On my client list grid I have a link on each line to edit the existing client. I also have an Add Button on the screen that will be used for adding a new client. When you click the link for an existing client in the grid the following redirect takes place:
Response.Redirect"ClientEditForm.aspx?clientID={0}"
The {0} string gets filled with the unique client id of the selected record. This is done by my grid.

When the Add Client button is depressed the following redirect takes place:
Response.Redirect("ClientEditForm.aspx?ClientID=0")
Notce the value I pass is 0 (zero). This will be an indicator to the edit form that we want to add a new record.

And lastly, here is the page_load for the ClientEdit form"
 // Instantiate the Business objects and register with the form
        this.oClient = (Client)this.RegisterBizObj(new Client());       
        // Retrieve the client id passed by the page sending the request
        this.iClientID = int.Parse(Request.QueryString["clientID"]);
        if (this.iClientID == 0)
        {
            // Add new client
            this.oClient.NewEntity();
        }
        else
        {
            // Retrieve the specified client record
            this.oClient.GetClientbyClientID(this.iClientID);
        }
        Session["dsClient"] = this.oClient.DataSet;
HTH
;>Hi,
>
>the jump starts are great for editing existing data. Are there any examples on how to add new records in a web forms app?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform