Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Setting field value in EditItemTemplate column

Reply
Thread Tools

Setting field value in EditItemTemplate column

 
 
Zach Wells
Guest
Posts: n/a
 
      04-06-2004
I have a checkbox in the EditItemTemplate column that I *almost* have
working, just stuck on one little thing.

When I click edit on the row, I can display the checkbox as I want, the
only problem is I can't seem to figure out how to get the value that was
there in the checkbox.

This is what I am trying in my ItemBound event:

If (e.Item.ItemType = ListItemType.EditItem) Then
Dim chk As CheckBox
chk = CType(e.Item.Cells(7).FindControl("chkORSecurity_T able"),
CheckBox)

chk.Checked = IIf(e.Item.Cells(7).Text.ToUpper = "YES",
True, False)
End If

The problem is that e.Item>Cells(7).Text returns an empty string,
instead of "YES", which is the value displayed in the cell prior to
clicking edit. I'm assuming that the reason the cell is empty is that
I've already switched to "edit" mode and thus, there is no value in that
field, only my control. So, how do I set the checkbox to the right
value? Where do I get the value that was in the cell prior to clicking Edit?

Zach
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
GridView - Setting the text of the 'select' column to the value of another column Greg Smith ASP .Net 0 04-12-2007 03:11 PM
GridView - Setting the text of the 'select' column to the value of another column Greg Smith ASP .Net Web Controls 0 04-12-2007 02:40 PM
null value when inserting/updating from EditItemTemplate field xazos79 ASP .Net 0 12-19-2005 03:33 PM
how do i access a dropdownlists selected value in a datagrid edititemtemplate column from the selectedindexchanged event of another dropdownlist in a datagrid edititemtemplate column Dave M ASP .Net Datagrid Control 0 12-14-2004 11:53 AM



Advertisments