Update Data using a DataGrid

From: Claude G (Frac ((Frac_at_discussions.microsoft.com)
Date: 08/24/04

  • Next message: chris: "Query tables across multiple databases with sql"
    Date: Tue, 24 Aug 2004 12:43:08 -0700
    
    

    I would like to use a Column button Edit/Udate Cancel to modify information
    content in a DataGrid Connected to an SQL Data base

    I used the editCommand to switch the column in edit mode with success
    with the following code

    Private Sub GridDepartement_EditCommand....

    GridDepartement.EditItemIndex = e.Item.ItemIndex
            GridDepartement.DataBind()

    But I cannot get the updated content of the cells with he Update Command
    I tried without success the two following code

    1/ Private Sub GridDepartement_UpdateCommand...

             Dim DepartementBox As TextBox
            Dim iddepartementBox As TextBox
            newDepartement = Request.Form.Item(1).ToString()
            DepartementBox = CType(e.Item.Cells(1).Controls(0), TextBox)
            newDepartement = DepartementBox.Text
            iddepartementBox = CType(e.Item.Cells(0).Controls(0), TextBox)
            Dim idDepartement As Integer =
    System.Int16.Parse(iddepartementBox.Text)
            GridDepartement.EditItemIndex = -1

    I can only read the the cell with their initial value without the modification

    2 / Private Sub GridDepartement_UpdateCommand...

           Dim newDepartement As String
           Dim iddepartementBox As TextBox
           newDepartement = Request.Form.Item(1).ToString()
            Dim idDepartement As Integer =
    System.Int16.Parse(iddepartementBox.Text)
            GridDepartement.EditItemIndex = -1

      In this case I get an empty content in newDepartement


  • Next message: chris: "Query tables across multiple databases with sql"