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

Dynamic GUI in ASP.NET

Hi all:

I am trying to build a web interface for a CRM demo I am working on, and one
of the questions on the registration form is "How many children do you
have?" and then I want the user to be able to enter info for each child.

So I'd like the page to function such that if the user enters "4", the
interface updates and displays 4 input rows with textboxes for name, age,
etc. This seems to be hard to do in ASP.NET, does anyone think AJAX might be
an answer? Can anyone offer any other ideas as to how I might accomplish
this?

Thanks.

--
John.

http://mscrmguy.blogspot.com/

Oct 1 '07 #1
3 1223
"MscrmGuy" <js********@hotmail.comwrote in message
news:92**********************************@microsof t.com...
Hi all:

I am trying to build a web interface for a CRM demo I am working on, and
one
of the questions on the registration form is "How many children do you
have?" and then I want the user to be able to enter info for each child.

So I'd like the page to function such that if the user enters "4", the
interface updates and displays 4 input rows with textboxes for name, age,
etc. This seems to be hard to do in ASP.NET, does anyone think AJAX might
be
an answer? Can anyone offer any other ideas as to how I might accomplish
this?
You can add controls dynamically with ASP.NET. Using an asp:table you can
add your 4 rows, each containing the number of cells you want. Then you add
the type of controls you want; labels, texboxes, images and so on into each
cell. It is a good idea to use a loop-counter and give each control a unique
ID based on the rowID+controlname. Then you easily can retrieve the entered
values on postback.

One trick that challenged me was that the dynamically controls must be
created each time the page is posted back. The data entered into each
control are automatically stored into viewstate, but you have to design a
loop in the page load section to regrenerate the rows of controls. I'm sorry
I don't have any relevant links for the, but google for "adding controls
dynamically" and you will surely find a lot of info.

Bjorn
Oct 1 '07 #2
Bjorn's hit the nail on the head here, and he's right the trickiest part is
having to creating the controls on each postback even tho' the data is
stored in the ViewState.
I do this type of thing all the time and it works perfectly.

I would highly recommend: Creating a simple project/website completely
separate from whatever you're working, just to play around with the
concepts.

"Bjorn Sagbakken" <bj*****@online.nowrote in message
news:Ke*********************@telenor.com...
"MscrmGuy" <js********@hotmail.comwrote in message
news:92**********************************@microsof t.com...
>Hi all:

I am trying to build a web interface for a CRM demo I am working on, and
one
of the questions on the registration form is "How many children do you
have?" and then I want the user to be able to enter info for each child.

So I'd like the page to function such that if the user enters "4", the
interface updates and displays 4 input rows with textboxes for name, age,
etc. This seems to be hard to do in ASP.NET, does anyone think AJAX might
be
an answer? Can anyone offer any other ideas as to how I might accomplish
this?

You can add controls dynamically with ASP.NET. Using an asp:table you can
add your 4 rows, each containing the number of cells you want. Then you
add the type of controls you want; labels, texboxes, images and so on into
each cell. It is a good idea to use a loop-counter and give each control a
unique ID based on the rowID+controlname. Then you easily can retrieve the
entered values on postback.

One trick that challenged me was that the dynamically controls must be
created each time the page is posted back. The data entered into each
control are automatically stored into viewstate, but you have to design a
loop in the page load section to regrenerate the rows of controls. I'm
sorry I don't have any relevant links for the, but google for "adding
controls dynamically" and you will surely find a lot of info.

Bjorn

Oct 1 '07 #3
As an alternative, you could have one data entry form and an Add
button and then below it have a GridView that displays the details
that have already been submitted. This may be a mroe flexible option
as you don't need to consider how to handle someone changing their
mind - such as remembering that they actually have a 5th child.

You won't need to remember to recreate any controls, only to execute
GridView.DataBind in your AddButton.Click method to refresh the
GridView.

Mike

Oct 1 '07 #4

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

Similar topics

0
by: Roel Wuyts | last post by:
CALL FOR CONTRIBUTIONS International Workshop on Revival of Dynamic Languages http://pico.vub.ac.be/~wdmeuter/RDL04/index.html (at OOPSLA2004, Vancouver, British Columbia, Canada, October...
1
by: Guinness Mann | last post by:
When you guys talk about "dynamic SQL," to what exactly are you referring? Is dynamic SQL anything that isn't a stored procedure? Specifically, I use ASP.NET to communicate with my SQL Server...
6
by: Materialised | last post by:
Hi Everyone, I apologise if this is covered in the FAQ, I did look, but nothing actually stood out to me as being relative to my subject. I want to create a 2 dimensional array, a 'array of...
3
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
0
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab,...
7
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We...
1
by: Peterwkc | last post by:
Hello all expert, i have two program which make me desperate bu after i have noticed the forum, my future is become brightness back. By the way, my problem is like this i the first program was...
5
by: bearophileHUGS | last post by:
I often use Python to write small programs, in the range of 50-500 lines of code. For example to process some bioinformatics data, perform some data munging, to apply a randomized optimization...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
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,...

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.