I'm working on a fun 'survey' form and am trying to break up the tedium by over complicating the process. I have a group of radiobuttonlists that I want to dynamically create from a string of names and a string of values. The values is not a problem. It's creating all the radiobuttonlists that I can't figure out.
For instance I could just keep doing this:
string[] level = {"Expert", "Proficient", "Limited Experience", "No Experience"};
this.rblCSharp.Items.Clear();
for (int i = 0; i < level.GetLength(0); i++) {
this.rblCSharp.Items.Add(level[i]);
}
this.rblCSharp.RepeatDirection = RepeatDirection.Horizontal;
this.rblVbNet.Items.Clear();
for (int i = 0; i < level.GetLength(0); i++)
{
this.rblVbNet.Items.Add(level[i]);
}
this.rblVbNet.RepeatDirection = RepeatDirection.Horizontal;
...but I don't want to. I want to do something more like this:
string[] level = {"Expert", "Proficient", "Limited Experience", "No Experience"};
string[] language = { "CSharp", "VbNet", "VbClassic", "Crystal", "Ssrs", "Sql2005", "UiWeb" };
for (int j = 0; j < language.GetLength(0); j++) {
this.rbl[j].Items.Clear();
for (int i = 0; i < level.GetLength(0); i++) {
this.rbl[j].Items.Add(level[i]);
}
this.rbl[j].RepeatDirection = RepeatDirection.Horizontal;
}