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

Dynamic Forms???

Hi,

Can someone please tell me the best way to create a web form on the fly
according to a users input???

EG: If a user chooses the number 3 from a dropdownlist 3 textbox items are
created... or if they choose 4 for textboxes are created.

Should AI use a repeater or what is the best solution??? I would be grateful
for any advice! The other thing is if the user chooses 3 textboxes and they
are dynamically created how do I create an unique id for each textbox???

Thanks for any advice!
Nov 19 '05 #1
4 1102
Hi Tim,

I feel the best way to create controls is by using a for loop. A repeater
control, according to me would be an overkill. You can still use a repeater
but you need to capture the values in an array / datatable and bind it to the
repeater and then do a databind. But a loop would be sufficient for this.

Label lbl;
for(int i=0;i<User_Defined_Value;i++)
{
lbl = new Label();
lbl.Id = "Label"+i;
}
This should do the trick...

Every control has a property called ID, by which you can set it.

Coming to creating a form on fly ..... its bit tricky..

You need to use add the controls to the page in the page load event or init
event....

HTH,

Need any help, do post a msg back...

Happy Coding

"Tim::.." wrote:
Hi,

Can someone please tell me the best way to create a web form on the fly
according to a users input???

EG: If a user chooses the number 3 from a dropdownlist 3 textbox items are
created... or if they choose 4 for textboxes are created.

Should AI use a repeater or what is the best solution??? I would be grateful
for any advice! The other thing is if the user chooses 3 textboxes and they
are dynamically created how do I create an unique id for each textbox???

Thanks for any advice!

Nov 19 '05 #2
Hi Tim,

I feel the best way to create controls is by using a for loop. A repeater
control, according to me would be an overkill. You can still use a repeater
but you need to capture the values in an array / datatable and bind it to the
repeater and then do a databind. But a loop would be sufficient for this.

Label lbl;
for(int i=0;i<User_Defined_Value;i++)
{
lbl = new Label();
lbl.Id = "Label"+i;
}
This should do the trick...

Every control has a property called ID, by which you can set it.

Coming to creating a form on fly ..... its bit tricky..

You need to use add the controls to the page in the page load event or init
event....

HTH,

Need any help, do post a msg back...

Happy Coding

"Tim::.." wrote:
Hi,

Can someone please tell me the best way to create a web form on the fly
according to a users input???

EG: If a user chooses the number 3 from a dropdownlist 3 textbox items are
created... or if they choose 4 for textboxes are created.

Should AI use a repeater or what is the best solution??? I would be grateful
for any advice! The other thing is if the user chooses 3 textboxes and they
are dynamically created how do I create an unique id for each textbox???

Thanks for any advice!

Nov 19 '05 #3
Dim Textboxes() as Textbox

redim Textboxes(TextboxCount)

For x=1 to TextBoxCount
Dim Textboxes(x) as New TextBox
TextBoxes(x).Text = "Fill Me out"
Textboxes(x).ID = "Text" & x
PlaceHolder1.Controls.Add(Textboxes(x))
next x

That will create "TextBoxCount" number of textboxes using an array and
using the element value to make the ID's unique.

You can then add each one to a placeholder or other object.
Textboxcount can be a session value passed from a previous page.


On Mon, 14 Feb 2005 08:13:08 -0800, "Tim::.." <myatix_at_hotmail.com>
wrote:
Hi,

Can someone please tell me the best way to create a web form on the fly
according to a users input???

EG: If a user chooses the number 3 from a dropdownlist 3 textbox items are
created... or if they choose 4 for textboxes are created.

Should AI use a repeater or what is the best solution??? I would be grateful
for any advice! The other thing is if the user chooses 3 textboxes and they
are dynamically created how do I create an unique id for each textbox???

Thanks for any advice!


Nov 19 '05 #4
Dim Textboxes() as Textbox

redim Textboxes(TextboxCount)

For x=1 to TextBoxCount
Dim Textboxes(x) as New TextBox
TextBoxes(x).Text = "Fill Me out"
Textboxes(x).ID = "Text" & x
PlaceHolder1.Controls.Add(Textboxes(x))
next x

That will create "TextBoxCount" number of textboxes using an array and
using the element value to make the ID's unique.

You can then add each one to a placeholder or other object.
Textboxcount can be a session value passed from a previous page.


On Mon, 14 Feb 2005 08:13:08 -0800, "Tim::.." <myatix_at_hotmail.com>
wrote:
Hi,

Can someone please tell me the best way to create a web form on the fly
according to a users input???

EG: If a user chooses the number 3 from a dropdownlist 3 textbox items are
created... or if they choose 4 for textboxes are created.

Should AI use a repeater or what is the best solution??? I would be grateful
for any advice! The other thing is if the user chooses 3 textboxes and they
are dynamically created how do I create an unique id for each textbox???

Thanks for any advice!


Nov 19 '05 #5

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

Similar topics

7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
1
by: mtech1 | last post by:
Access 2002 I am trying to create a dynamic crosstab report that parameters come from 3 different forms. I get runtime error 3070 - The Microsoft Jet database engine does not recognize...
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...
7
by: AdeelAlvi | last post by:
iam working on a project called service desk that automates the departmental services online .one major component i have to create is that to convert paper based forms into dynamic webforms . i...
2
by: deejayquai | last post by:
Hi I'm trying to produce a report based on a dynamic crosstab. Ultimately i'd like the report to actually become a sub report within a student end of year record of achievement. The dynamic...
3
by: RahimAsif | last post by:
I am writing an application that requires the a portion of the main menu to be dynamic. The menu has file, panels, view files and help across the top. The view files sub menu needs to be...
5
by: matt | last post by:
hello, i am on an interesting project. in this project, i have to create dynamic data-entry forms for offline-users to fill out, save locally, and eventually postback to our app (when back...
0
by: JamesOo | last post by:
I have the code below, but I need to make it searchable in query table, below code only allowed seach the table which in show mdb only. (i.e. have 3 table, but only can search either one only,...
2
by: yomadhu | last post by:
I created a dynamic form in javascript. Am unable to get those values in to php to display. I need all details. If i add 10 rows the i need to display those all values. Can any one help me for that...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
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.