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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit Mode in Datagrid

Status
Not open for further replies.

bartee

MIS
Joined
Mar 20, 2005
Messages
147
Location
US
I have a datagrid and one of the columns in my datagrid is a textbox.

I used the following code in the itemdatabound event to display checkedon or checkedoff based upon the value 0 or 1:


If e.item.cells(3).text = 1 then


dim checkb as checkbox = new checkbox
checkb = ctype(e.item.findcontrol("checkbox1"),checkbox)
chkb.checked = true

end if

The above code works fine. The problem is that I also have and edit column in my data grid.

I added another checkbox for the edit value of the template button called checkbox2.

I placed the following code in the same event just below the above code:


dim checkb as checkbox = new checkbox
checkb = ctype(e.item.findcontrol("checkbox2"),checkbox)
chkb.checked = true

However, this checkbox in edit mode always appears unchecked, regradless if the value is 0 or 1.

Any suggestions greatly appreciated. Thanks in advance.
 
I would first try debugging and checking if your findcontrol of checkbox2 is actually being found. Stop on the line following the findcontrol and see if checkb has a value or is NOTHING.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top