DataGrid Help: Dynamically columned DataGrid and WebControls?
Hopefully someone can offer some insight into this... I've been starting to pull my hair out, and I am too young to go bald.
On this one page, I dynamically generate a couple of datagrids all though code (nothing in the webpage itself). It is for a survey, and depending on how many question types are in the system, it has to generate a datagrid for each, and then it needs columns for each of the responses (Yes/No, Excellent/Very Good/Good/Poor/Horrible). So I can't use a static datagrid, since I don't know how many grids I need, and the number of columns will vary, so no way to use a <asp:RadioButton> for the responses.
I've got the tables to all show up. I create the datagrid, create a datatable and add all of the columns and then the rows. If I put the plain HTML for the radio button into the table, the radio shows up, but I cannot get its values when I submit it. Not even though Request[”question1”]. If I create a RadioButton object and set the column to it, nothing shows up. The column just disappears. I've tried declaring an array of RadioButtons within the scope of the whole page, and still doesn't work.
Anyone have any ideas? Some better way I could do it? If I declare the DataGrid within the scope of the whole class will it work? If it helps, you can check out my code. Please! Before I go bald!