How to get Text entered in TextBoxes and if Checkboxes are Checked from a DetailsView that is in Edit Mode RRS feed

  • Question

  • User2028823583 posted

    I'm struggling with getting values that have been keyed in a DetailsView that is in Edit Mode.  Using the code below from my CodeBehind, I can "find" the values for three labels that are in my Employee DetailsView that are not editable.  These fields are just listed to identify the Employee Name, and Date of Hire that is being edited.    

    How do I get the data that is keyed into textboxes, dropdowns and checkboxes in my detailsview when it's in Edit mode?     

    Dim employeeFirstName As String = dvEmployee.Rows(1).Cells(1).Text
    Dim employeeLastName As String = dvEmployee.Rows(2).Cells(1).Text
    Dim employeeDOH As String = dvEmployee.Rows(3).Cells(1).Text

    Friday, April 19, 2019 12:34 PM


  • User2028823583 posted

    Figured it out...  Dim myCheckBox As CheckBox = DirectCast(dvEmployee.FindControl("cbAtHome"), CheckBox)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 19, 2019 5:53 PM