473,770 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic user control properties

novice question here...

I am building a registration form while learning Asp.Net. I am having
trouble passing data between "dynamicall y"-added server controls.

To simplify, I have a single Registration.as px 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(objec t sender, System.EventArg s e){
regdetails = LoadControl("Re gDetails.ascx") ;
regsummary = LoadControl("Re gSummary.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 2375

"Chris" <ch*********@ya hoo.com> wrote in message
news:14******** *************** ***@posting.goo gle.com...
novice question here...

I am building a registration form while learning Asp.Net. I am having
trouble passing data between "dynamicall y"-added server controls.

To simplify, I have a single Registration.as px 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(objec t sender, System.EventArg s e){
regdetails = LoadControl("Re gDetails.ascx") ;
regsummary = LoadControl("Re gSummary.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
3579
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. One of these user controls handles the navigation. This user control polls the database for the section headers that the current user has access to. It grabs those headers from the database, let's say 5 of them, then
3
6830
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 figure out, if there is a way of using polymorphic way (if that is a word) of doing this particular property. A sample of my code is as follows: DynamicControls.ButtonControl(this,btnSearchByName, new Point(5, 75), new Size(95, 20),...
3
13715
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. This all works well, but i would like the color to be configurable via the app.config file.
1
3152
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 many questions. To keep it simple, I'll describe the basics of what I'm trying to design. I've created a TextBox composite control that consists of a label for
2
1348
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 datagrid. This datagrid has a button in a column that loads another datagrid(user control) when clicked. This new grid also has a column with a button that loads another user control. So, there could be 3 user controls on this form if all the
0
1704
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 single worksheet into a dataset. I successfully built a dynamic datagrid. And I did successfully bind it to the dataset. Then I added the datagrid control to a PlaceHolder. The first worksheet displays beautifully. The next step is to allow...
1
1963
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 these text boxes when the user submits or posts back to the server. My intention was to create a textboxvalidator function which takes the control name as argument and returns an true if
0
1912
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 they behave and look all the same. Creating dynamic chart code looks something like this.... ///////////////////////////////////////////////////////////////////////////////// Sub CreateChartControl(ByVal sender As Object, ByVal e As EventArgs)...
9
3628
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 to create the dynamic controls in the OnInit stage of the lifecycle. Since data from static controls is not yet available in the OnInit stage I can't know what dynamic control I have to create.
4
51672
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 controls need to be dynamically loaded according to user input. This simple example can be further extended to dynamically load custom web user controls. Background Please familiarize yourself with the ASP.NET Page Life Cycle. It is crucial to...
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10257
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10037
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.