...

View Full Version : data grid and checkboxes



reubenb
10-27-2010, 01:47 AM
Hello!

I have a table for completion of different type of forms that has 'complete' and 'incomplete' (as text) in the different fields.

i want to make a datagrid that lists all the rows and then in each field has checkbox that if selected updates that row in that field to 'complete' and if they unselect it updates the field in that row to 'incomplete'.

it also has an id field that should show the name of the applicant which is linked to another table.

i dont understand how to do this in a datagrid

any assistance would be grateful!

.NetCoder
10-30-2010, 06:44 AM
Hi,

First of all you meant gridview when you say datagrid right.

A design question. Why would you want to have two separate fields in the table to store complete and incomplete status. You could have had a bit field (for MS SQL) or a single text field if you think you will have more status in future. Manage what you have to save in this field through code.

Ok to the issue now.

You must be populating the grid using a datasource or a list right

If you have the table structure as stated above then you could use an Object Datasource or an SQL Datasource to bind your table data. Having the field as a bit field will automatically create your check box field in the grid and you will not have to write bulks of code. Except the logic to Insert and update a record.

If you are manually binding the gridview using a list then you will require a little bit more work like adding a template field and a checkbox and handling some gridview events etc.

Question would be how are you binding the gridview I guess?

Shaheem

alfradthomas
11-26-2010, 08:18 AM
uxSurveyGrid.DataSource = searchResults;
uxSurveyGrid.DataBind();



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum