Hello,
I have stuck with an issue in my project. So please help me
A brief description about what I have done till now:
There are two drop down lists in my page. The first lists the projects. On selection of a project, the second drop down populates based on the project id. When a second drop down is selected I
am calling a stored procedure by passing the selected item value. The stored procedure returns me a table with the values in the following format.
ID Name colname1 colname2 colname3 colname4 . . . . . colnameN
1 feature1 0 0 1 0 1
1 feature2 0 1 0 1 0
1 feature3 0 0 1 0 1
.
.
.
1 featureN 0 1 0 1 0
The number of columns is not know until run time and is depending on the ID passed by the second drop down list. The first column will be always ID, and second column will be always strings and the remaining columns will be either 0 or 1. I need to create a user interface with the above structure in a tabular form replacing the 0s and 1s with check box controls either unchecked(if 0) or checked(if 1). The users will modify the check boxes( check or uncheck) and click on update button. I need to update the database by mapping the values in the UI. i.e. I have four columns in DB with ID, Name, ColumnName and selected. I need to identify that for what feature and for what column the checkbox is checked or unchecked and update the values appropriately.
I am using a grid view and dynamically generating the columns in the code behind using TemplateField class. I am inheriting the ITemplate and generating the checkboxes and displaying in the grid.
Now the problem is on form submission I am unable to get the values of checkboxes in code behind for updating database. I am using
CheckBox cb = (CheckBox)GridView1.Rows[rowcount].Cells{columnCount].FindControl("chk");
but this cb is always null. May be because the checkbox Id are assigned automatically(this is came to know by viewing the page source) as the check boxes are generated dynamically.
Please help me how to find the check box status in code behind after update button is clicked. Is there any other way of doing this other than using Gridview???