Re: code organization
- From: Michael Nemtsev [MVP] <nemtsev@xxxxxxx>
- Date: Mon, 14 Jan 2008 20:57:59 +0000 (UTC)
Hello J,
declare the valiable as class field and store dataTable in cache
---
WBR, Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it" (c) Michelangelo
J> I'm using codebehind in ASP.Net.
J> J> public partial class edit : System.Web.UI.Page
J> {
J> protected void Page_Load(object sender, EventArgs e)
J> {
J> // populate the dataset, etc.
J> txtFirstName.Text =
J> dsContact.Tables["Contact"].Rows[0]["FName"].ToString();
J> txtLastName.Text =
J> dsContact.Tables["Contact"].Rows[0]["LName"].ToString();
J> }
J> protected void btnSave_Click(object sender, EventArgs e)
J> {
J> // I would like to do something like this
J> dsContact.Tables["Contact"].Rows[0]["FName"] =
J> txtFirstName.Text;
J> dsContact.Tables["Contact"].Rows[0]["LName"] =
J> txtLastName.Text;
J> }
J> }
J> J> In Page_Load, a few dataset's are populated and the page is updated
J> with the results of the datasets. When the Save button is clicked,
J> I want to use the same datasets to update the tables in the db.
J> What's the best way to make these datasets (like dsContact in the
J> code)
J> visible to both Page_Load and btnSave_Click?
.
- References:
- code organization
- From: J
- code organization
- Prev by Date: Re: asp:menu requires Page.Header to be non-null
- Next by Date: Text Box events
- Previous by thread: code organization
- Next by thread: Re: Why am I getting this error?
- Index(es):