C
Chris
novice question here...
I am building a registration form while learning Asp.Net. I am having
trouble passing data between "dynamically"-added server controls.
To simplify, I have a single Registration.aspx page that contains 2
panels. Each panel is loaded with a user control during Page_Load():
protected Panel panel1;
protected Panel panel2;
protected Control regdetails;
protected Control regsummary;
private void Page_Load(object sender, System.EventArgs e){
regdetails = LoadControl("RegDetails.ascx");
regsummary = LoadControl("RegSummary.ascx");
panel1.Controls.Add(regdetails);
panel2.Controls.Add(regsummary);
panel1.Visible=true;
panel2.Visible=false;}
A 'submit' button click event changes which panel is visible. When
the new panel becomes visible, I would like the regsummary user
control's fields (textboxes or labels) to reflect the data entered
into the regdetails control.
I will not go into all the ways I've tried to do this. What I'd like
to know is what is the "correct" way to accomplish something like
this. If someone could just point me in the right direction, suggest
articles, google searches, etc...
btw, I realize my approach to this may be all wrong - maybe I should
just be saving the values some other way (to file, session?) and
loading a new page altogether. My books don't delve into user
controls deeply enough. Anyway, I'm learning...
Thanks,
Chris
I am building a registration form while learning Asp.Net. I am having
trouble passing data between "dynamically"-added server controls.
To simplify, I have a single Registration.aspx page that contains 2
panels. Each panel is loaded with a user control during Page_Load():
protected Panel panel1;
protected Panel panel2;
protected Control regdetails;
protected Control regsummary;
private void Page_Load(object sender, System.EventArgs e){
regdetails = LoadControl("RegDetails.ascx");
regsummary = LoadControl("RegSummary.ascx");
panel1.Controls.Add(regdetails);
panel2.Controls.Add(regsummary);
panel1.Visible=true;
panel2.Visible=false;}
A 'submit' button click event changes which panel is visible. When
the new panel becomes visible, I would like the regsummary user
control's fields (textboxes or labels) to reflect the data entered
into the regdetails control.
I will not go into all the ways I've tried to do this. What I'd like
to know is what is the "correct" way to accomplish something like
this. If someone could just point me in the right direction, suggest
articles, google searches, etc...
btw, I realize my approach to this may be all wrong - maybe I should
just be saving the values some other way (to file, session?) and
loading a new page altogether. My books don't delve into user
controls deeply enough. Anyway, I'm learning...
Thanks,
Chris