473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

dynamic user control properties

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
Nov 18 '05 #1
1 2355

"Chris" <ch*********@yahoo.com> wrote in message
news:14**************************@posting.google.c om...
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 personally, would not bother with hiding/showing different panels, I would
make the data live either in the cache or session data depending on the type
of form, or possibly send it as hidden fields on the page. Could also use
something like my free control to switch the user controls. Might be
overkill in this case however.

--
Rocky Moore
www.HintsAndTips.com - ~ Post Tips and Promote Your Site or Service at No
Charge ~
www.RJSoft.com/Products/RJContentPanel/ - Free web user content control!
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steve Gadlin | last post by:
Hi there! First off, let me apologize for the basic question... I'm very new to .NET programming. I'm building a web site using VB.NET, and am trying to include several custom user controls. ...
3
by: MikeY | last post by:
Hi Everyone, I am working in C#, windows forms.My question is this. All my button dynamic controls properties are present and accounted for except for the"FlatStyle" properties. I can't seem to...
3
by: Guy Harwood | last post by:
Hi, I have designed a textbox that inherits from the System.Windows.Forms.Textbox control. when the control is readonly the back color changes to a light blue to indicate that it is frozen. ...
1
by: sleigh | last post by:
Hello, I'm building a web application that will build a dynamic form based upon questions in a database. This form will have several different sections that consist of a panel containing one to...
2
by: Rubble | last post by:
Hello, Ive searched all over the net trying to find an answer to this...so anybody with some expertise in this area would be greatly appreciated. Background: I have a webform that loads a...
0
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a...
1
by: Kum | last post by:
Hi, I need help in asp.net dynamic textbox controls validation. I am creating textbox controls dynamically on a asp.net webpage. Now after creating the textboxes on the page I want to validate...
0
by: jaawaad | last post by:
I'm creating webcharts control dynamically based on user input as to how many charts they would like to see. I'm running into problem as to how to set properties for those charts at run time so...
9
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have...
4
Frinavale
by: Frinavale | last post by:
Introduction Sometimes, when developing web applications, we need to be able to dynamically load controls based on user selections. The following article describes a simple scenario where TextBox...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.