473,508 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic controls creation - issue

Sri
Hi,

I need to create controls dynamically on click of a button.
When the user click on a button, I need to create a text box, dropdown
list and check box in a row. Additional row has to be created with the
controls on each click of the button. I am able to recreate the
controls each time on Page_load event by maintaining the number of rows
as a Viewstate variable. But I am not able to retain the values entered
in the textbox/dropdownlist. How to retain the values in the
dynamically created controls? I tried with having ViewState variable
for each and every control. But somehow it is not retained. Please let
me know if there is any way to achieve this.

Thanks
Sri

Jun 19 '06 #1
1 1049
Hi

I had a similar problem which I fixed.

I would suggest that you put your text box, dropdown and check box in a
user control and add that dynamically. Instead of just doing simply
Controls.Add(myControl), you need to load the "whatever.ascx" using:

myControl = LoadControl("whatever.ascx");
Page.Controls.Add(control);

Make sure you do this in your CreateChildControls() method on your
page. You should then find that the controls maintain their state and
so on without your having to intervene manually. If they don't, there's
something you're not doing right...

Hope this helps,

Mark
Sri wrote:
Hi,

I need to create controls dynamically on click of a button.
When the user click on a button, I need to create a text box, dropdown
list and check box in a row. Additional row has to be created with the
controls on each click of the button. I am able to recreate the
controls each time on Page_load event by maintaining the number of rows
as a Viewstate variable. But I am not able to retain the values entered
in the textbox/dropdownlist. How to retain the values in the
dynamically created controls? I tried with having ViewState variable
for each and every control. But somehow it is not retained. Please let
me know if there is any way to achieve this.

Thanks
Sri


Jun 19 '06 #2

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

Similar topics

2
16230
by: charliewest | last post by:
I need to create textboxes in real-time, the actual number of which is determine by a result from a database query. I have been able to create the controls, and then add them to the ASPX page....
2
2541
by: Dave Williamson | last post by:
When a ASPX page is created with dynamic controls based on what the user is doing the programmer must recreate the dynamic controls again on PostBack in the Page_Load so that it's events are wired...
1
1196
by: Homam | last post by:
So I have a composite paging control that shoulld be positioned on the page like this: PagNav ResultSetDisplay PagNav I know that I can't resuse the PagNav more than once in the form, so I...
7
2548
by: msdev | last post by:
Hello, I am creating my own webbrowser to learn VB .Net. I am stuck on an issue with regards to dynamically-created controls, in this case tabs on a tabcontrol and webbrowsers created within...
0
1120
by: Paul | last post by:
Hi! I have been wondering about a design issue for some time now and hope someone can help sort this one out for me. Say you have to create some webcontrols dynamically. Each controls creation...
0
7321
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
7377
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
7489
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...
0
5624
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1547
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.