469,903 Members | 2,171 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,903 developers. It's quick & easy.

Dynamic Controls in asp.net using C# LOGIC..please help....

Hello People,

I would appreciate your responses on this.

I am writing an asp.net web-application involving C#. I am actually building
a test hierarchy at the moment, which involves producing dynamic controls,
depending on user response.

To be more precise, I prompt the user for the number of questions, that
should be in the test. He types in a number, say 10. Then I need to ask him
the details of the first question, i.e. number of sub-parts in question 1.
The user should be prompted to select through a radio button group, as to how
many sub-parts he wants to enter i.e. 0,1,2,3 or 4. Then following that I
will be asking him the same details for the number of sub-parts for the first
sub-part 1, i.e. 1.1. The maximum depth allowed will be 3.

After completing the details for the first question, I then need to prompt
the user to get details for the second question, and then the third, till the
end of the test. The maximum depth that the hierarchy goes to is 3, i.e.
something like 1.1.3 will be a valid question id, but not 1.1.3.2

As it turns out it is in effect a tree structure that I need to implement in
asp.net, depending on user input.

Now the problem is that I cannot do all this in a single loop, because I
need to handle each question at a time, and also remember what the user
entered, and then respond at each user-selection.

Any ideas how I can handle this ? Any ideas that you guys might have will be
appreciated.

Just to clarify my problem here is a simple diagram of a sample hierarchy.

Num Questions:- 4

Question 1 sub-parts: - 2
Question 1.1 sub-parts : 2 i.e. 1.1.1 and 1.1.2
Question 1.2 sub-parts: 2 i.e. 1.2.1 and 1.2.2

Question 2 sub-parts: - 2
Question 2.1 sub-parts : 2 i.e. 2.1.1 and 2.1.2
Question 2.2 sub-parts: 2 i.e. 2.2.1 and 2.2.2
..
..
..
..
..
Question 4 sub-parts.......
.....................................
.....................................


Regards,

Irfan
Nov 16 '05 #1
1 1340
Hi Irfan

Creating an XML document to represent this type of hierarchy would work
pretty well. Take a look at the System.Xml.XmlDocument class (and the
System.Xml namespace as a whole).

HTH

Nigel Armstrong

"Irfan Akram" wrote:
Hello People,

I would appreciate your responses on this.

I am writing an asp.net web-application involving C#. I am actually building
a test hierarchy at the moment, which involves producing dynamic controls,
depending on user response.

To be more precise, I prompt the user for the number of questions, that
should be in the test. He types in a number, say 10. Then I need to ask him
the details of the first question, i.e. number of sub-parts in question 1.
The user should be prompted to select through a radio button group, as to how
many sub-parts he wants to enter i.e. 0,1,2,3 or 4. Then following that I
will be asking him the same details for the number of sub-parts for the first
sub-part 1, i.e. 1.1. The maximum depth allowed will be 3.

After completing the details for the first question, I then need to prompt
the user to get details for the second question, and then the third, till the
end of the test. The maximum depth that the hierarchy goes to is 3, i.e.
something like 1.1.3 will be a valid question id, but not 1.1.3.2

As it turns out it is in effect a tree structure that I need to implement in
asp.net, depending on user input.

Now the problem is that I cannot do all this in a single loop, because I
need to handle each question at a time, and also remember what the user
entered, and then respond at each user-selection.

Any ideas how I can handle this ? Any ideas that you guys might have will be
appreciated.

Just to clarify my problem here is a simple diagram of a sample hierarchy.

Num Questions:- 4

Question 1 sub-parts: - 2
Question 1.1 sub-parts : 2 i.e. 1.1.1 and 1.1.2
Question 1.2 sub-parts: 2 i.e. 1.2.1 and 1.2.2

Question 2 sub-parts: - 2
Question 2.1 sub-parts : 2 i.e. 2.1.1 and 2.1.2
Question 2.2 sub-parts: 2 i.e. 2.2.1 and 2.2.2
.
.
.
.
.
Question 4 sub-parts.......
....................................
....................................


Regards,

Irfan

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.