473,320 Members | 1,872 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,320 software developers and data experts.

Creating controls dynamically based on a dynamic control

Hi,

Can someone provide some information on how to create a control dynamically
based on the contents of another dynamic control.

In my experience, all dynamic controls must be created in the Initialize
stage of an ASP.Net page life cycle. Because viewstate is not available in
the initialization stage, I cannot get the value of the 1st dynamic control
to create the second control.

I think building a server control would resolve this issue, but I'm looking
for something a little more straight forward.

Does anyone have any suggestions?
Nov 19 '05 #1
2 1507
Create container control - for example Panel or Literal Control. Then on the
server side add your dynamically created control like this:
pnl.Controls.Add...

Hope that helps!
Regards,
Kostadin Kostov

"Matt" wrote:
Hi,

Can someone provide some information on how to create a control dynamically
based on the contents of another dynamic control.

In my experience, all dynamic controls must be created in the Initialize
stage of an ASP.Net page life cycle. Because viewstate is not available in
the initialization stage, I cannot get the value of the 1st dynamic control
to create the second control.

I think building a server control would resolve this issue, but I'm looking
for something a little more straight forward.

Does anyone have any suggestions?

Nov 19 '05 #2
I'm not sure how this will help. Both the panel and literal control are
still populated based on viewstate, which is not available in the Initialize
stage of the page life cycle.

Maybe I wasn't clear with my question. I'm trying to figure out how to
build a dynamic control based on the contents of another dynamic control.

For example, let's say I have a dropdown box that is used to build a
multitude of other controls on the page. This dropdown box is data bound and
as such the information in the box is not available until after the
LoadViewState stage. Unfortunately, I need to add my controls in the Init
stage because my dynamically created controls need to be rebuilt from
viewstate. If I add them in the Load stage, the viewstate information is
lost. Can you see the catch 22 here?
Nov 19 '05 #3

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

Similar topics

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...
6
by: Glenn Owens | last post by:
I have an ASP.Net page on which there are serveral static controls (listboxes, radiobuttonlist and textboxes). These controls are used to create criteria from which the code-behind will dynamically...
12
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
5
by: SalamElias | last post by:
I am creating several chkBoxes dynamically and assigning an event handler in the Page_load as foillows ***************************** Dim chkCatOption As CheckBox = New CheckBox chkCatOption.Text...
5
by: Guillaume BRAUX | last post by:
Hello, What I want to do is to add a userControl to a form class witch is a different class from the one the button is generated. For example, I want to instanciate a label in "class1" and add...
8
by: | last post by:
I'm looking for some design guidance on a collection of projects I'm working on. The project involves a bunch of websites constructed out of a collection of user controls. Different user...
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
by: mohaaron | last post by:
I can think of a lot of reasons why this might need to be done but as far as I can tell it's not possible. I've been looking for a way to add HtmlTableRows to a table using a button click for a...
8
by: BillE | last post by:
When I create a control dynamically and it grows according to the content, the control Height property still returns the original default control height instead of the height after expanding. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.