Setting field value in EditItemTemplate column

Discussion in 'ASP .Net Datagrid Control' started by Zach Wells, Apr 6, 2004.

  1. Zach Wells

    Zach Wells Guest

    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_Table"),
    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
     
    Zach Wells, Apr 6, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. xazos79
    Replies:
    0
    Views:
    420
    xazos79
    Dec 19, 2005
  2. Greg Smith
    Replies:
    0
    Views:
    542
    Greg Smith
    Apr 12, 2007
  3. Dave M
    Replies:
    0
    Views:
    387
    Dave M
    Dec 14, 2004
  4. Greg Smith
    Replies:
    0
    Views:
    162
    Greg Smith
    Apr 12, 2007
  5. jr
    Replies:
    3
    Views:
    426
Loading...

Share This Page