I am using stringbuilder to create a radiobuttonlist dynamically for a survey I am working on. The code validates fine but will not render in HTML.
Is this because I am not supposed to use stringbuilder to generate asp web controls?
code here:
sb.Append(string.Format("<asp:RadioButtonList ID='" + qnumber + "' runat='server' RepeatDirection='Horizontal' RepeatLayout='flow' CssClass='answers'>"));
sb.Append(string.Format("<asp:ListItem Text='Strongly Agree' Value='1'></asp:ListItem>"));
sb.Append(string.Format("<asp:ListItem Text='Agree' Value = '2' ></ asp:ListItem>"));
sb.Append(string.Format("<asp:ListItem Text='Disagree' Value='3'></asp:ListItem>"));
sb.Append(string.Format("<asp:ListItem Text='Strongly Disagree' Value='4'></asp:ListItem>"));
sb.Append(string.Format("<asp:ListItem Text='Not Applicable' Value='5'></asp:ListItem></asp:RadioButtonList><asp:RequiredFieldValidator runat='server' ID='" + qnumber + "v"+ "' ControlToValidate='ID='" + qnumber + "' ErrorMessage='please answer the question' CssClass='warning' />"));