code organization
- From: "J" <nobody@xxxxxxxxxxx>
- Date: Mon, 14 Jan 2008 14:11:01 -0500
I'm using codebehind in ASP.Net.
public partial class edit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// populate the dataset, etc.
txtFirstName.Text =
dsContact.Tables["Contact"].Rows[0]["FName"].ToString();
txtLastName.Text =
dsContact.Tables["Contact"].Rows[0]["LName"].ToString();
}
protected void btnSave_Click(object sender, EventArgs e)
{
// I would like to do something like this
dsContact.Tables["Contact"].Rows[0]["FName"] = txtFirstName.Text;
dsContact.Tables["Contact"].Rows[0]["LName"] = txtLastName.Text;
}
}
In Page_Load, a few dataset's are populated and the page is updated
with the results of the datasets. When the Save button is clicked,
I want to use the same datasets to update the tables in the db.
What's the best way to make these datasets (like dsContact in the code)
visible to both Page_Load and btnSave_Click?
.
- Follow-Ups:
- Re: code organization
- From: Michael Nemtsev [MVP]
- Re: code organization
- Prev by Date: asp:menu requires Page.Header to be non-null
- Next by Date: Re: How many different values we may pass in a query string?
- Previous by thread: asp:menu requires Page.Header to be non-null
- Next by thread: Re: code organization
- Index(es):
Loading