Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bound checkbox

Status
Not open for further replies.

logi2000

Programmer
Jun 17, 2003
221
CR
i have a checkbox inside a datagrid. the checkbox needs to be bound to a column table of type char(1). the cehckbox should be checked or unchecked depending on the value of the column (Y/N).
how can i make to bound that checkbox to the table column, a meke it behave accordingly.

i am working in c#.

thanks
 
logi: Couple of ways to do this I suppose, but check out the technique at thread855-600329 and see if that solution might give you a bit of insight - I'm sure they'll be other suggestions, just a thought.
 
not really. i need to check the checkbox when the user clicks the edit link that is bound to the data grid.
 
Is your checkbox sitting inside of the <EditItemTemplate> and you need to check/uncheck it when switching the grid to edit mode?
Code:
<EditItemTemplate>
  <asp:CheckBox ID="editCheck" runat=server />
</EditItemTemplate>

private void myGrid_Edit(object source, DataGridCommandEventArgs e)
{
  CheckBox chk = (CheckBox)e.Item.FindControl("editCheck");
  if(<condition is met>)
  {
    chk.Checked = true;
  }
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top