Why am I getting the "old" value of a text box and

Results 1 to 2 of 2

Thread: Why am I getting the "old" value of a text box and

  1. #1
    Join Date
    Dec 1969

    Default Why am I getting the "old" value of a text box and

    Ok.. I am using .Net 2002 (for this project I have to..) and I have a data grid. When I edit the datagrid, and click update, I build my query - but I am always getting the "old" values and not the "new" values. My Update code is below. Thanks.<BR><BR>Stacey<BR><BR><BR>Sub grdCategories_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles grdCategories.UpdateCommand<BR> Dim MyKey As Integer<BR> Dim sSql As String<BR> Dim sCatName As String = CType(e.Item.Cells(clCatName).Controls(0), TextBox).Text<BR> Dim sCatDesc As String = CType(e.Item.Cells(clCatDesc).Controls(0), TextBox).Text<BR> Dim sCatDisplayOrder As String = CType(e.Item.Cells(clCatDisplayOrder).Controls(0), TextBox).Text<BR><BR> MyKey = grdCategories.DataKeys.Item(e.Item.ItemIndex)<BR> sSql = "UPDATE Categories SET Cat_Name=&#039;" + sCatName + "&#039;"<BR> sSql = sSql + " , Description=&#039;" + sCatDesc + "&#039;"<BR> sSql = sSql + " , Display_Order=" + sCatDisplayOrder<BR> sSql = sSql + " WHERE cat_id=" + CStr(MyKey)<BR><BR> Dim con As New OleDb.OleDbConnection(connectionstring)<BR> Dim cmd As New OleDb.OleDbCommand(sSql, con)<BR> con.Open()<BR> cmd.ExecuteNonQuery()<BR> con.Close()<BR> grdCategories.EditItemIndex = -1<BR><BR> BindGrid()<BR> End Sub

  2. #2

    Default RE: Why am I getting the

    You probably need to re-load the dataSet from the db and re-bind your data grid.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts