1

I have a Datagridview with first column as checkbox.I have created the checkboxcolumn at design itself.While updating the gridview according to the entries from database, I have to check and uncheck the checkbox programatically not all at a time but only a specific row.Please tell me how can I update check boxes programmatically.

1
  • Can you please be more specific? Commented Mar 28, 2012 at 6:14

5 Answers 5

2

You can bind the data from database directly to checkbox column if it is bit type in DB.

Sign up to request clarification or add additional context in comments.

Comments

2

Do something like this

(row.Cells[CheckBoxColumn.Index] as DataGridViewCheckBoxCell).value = false;

Comments

0

During bind data you need to check it manually if flag is true then set it checked otherwise unchecked as like

set checkbox1.checked=true or false

Comments

0

Check datagrid prerender event, get reference to the checkbox and set value accordingly.

Comments

0

At the time of databinding use this code

CheckBox chkbx= e.Item.FindControl("CheckBox1") as CheckBox;

then you can manipulate chkbx.Checked to true or false based on your values

and similarly it can be used for rest of the checkboxes buttons

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.