Hi,
I want to implement a functionality where i have a webdatagrid populated using a SQL datasource and the datagrid will be having a check box column to select the rows in the grid on the webpage. The user of the web page will select few rows from the web page by cheking the checkboxes for each row and will submit his selection.
On submit, I want to store the data of the checked rows by the user in a database.
For this, i am trying with using an unbound checkbox column in the web datagrid. But i am unable to fetch the row data for specific for the selection done by the user though the checkboxes. Please provide any pointers to implement this functionality.
Let me know if you need more clarification on the above.
Regards,
Ankit
Hi Ankit Jain,
Thank you for posting on our forums. I will be happy to assist you with your question.
Please use the following code to iterate through the rows on your grid and add the rows with the unbound checkbox checked to a collection:
//submit button
protected void Button1_Click(object sender, EventArgs e){WebDataGrid grid = this.WebDataGrid1;List<GridRecord> rowList = new List<GridRecord>();foreach (GridRecord row in grid.Rows)
{string key = row.Items[0].Column.Key;if (row.Items[0].Text == "True") { rowList.Add(row); }}}
I have also attached a sample that demonstrates my implementation. Please review the sample and let me know if you have any questions.