Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Controls

Status
Not open for further replies.

yu217171

Programmer
Aug 2, 2002
203
CA
Hi everyone,

I was wondering if I could get your opinion on something. I was asked to design a quiz for HR.

Something in the form below:

Category I

(1) I am cool. Agree O Disagree O Don't Know O
(2) You are cool. Agree O Disagree O Don't Know O

Category II

(1) I am cool. Agree O Disagree O Don't Know O
(2) You are cool. Agree O Disagree O Don't Know O


What would be the best way of designing this template? I already have the questions imported into the database (2 Tables) One category -> Many Questions is the relationship.

I briefly drafted up this code to spit the questions out.

Code:
private void LoadQuestions ()
		{
			DataSet dsHeaders = GetData ("select qHeadingID, qHeading from hrsurveyheadings");
			int count = 0;
			foreach (DataRow x in dsHeaders.Tables [0].Rows)
			{
				count = 1;
				Response.Write ("<h4>" + x.ItemArray [1].ToString () + "</h4>");
				DataSet dsQues = GetData ("select qQuestionID, qQuestion from hrsurveyquestions where qHeadingID = " + x.ItemArray [0].ToString ());
				foreach (DataRow y in dsQues.Tables [0].Rows)
				{
					Response.Write ("(" + count + ")&nbsp;&nbsp;" + y.ItemArray [1].ToString() + "<br><br>");
					count++;
				}
			}
		}

What would be the best way of going about this? A binded repeater control? Dynamically adding controls to a form? The use of placeholders?

Any suggestions would be greatly appreciated!

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top