GridView Update Works in XP, Not in 2000? Bug?



Has anyone heard about an ASP.NET 2.0 bug with retrieving values on the
fly from a GridView control when in Edit mode ? I have a GridView
built with an Edit button. When the Edit button is selected I enter a
new value into the one update text box. Upon selecting the Update
button the RowUpdating event is fired, for which I have coded the
snippet below. Running this code on an XP box works fine - the new
value entered into the text box is retrieved into the varField2
variable. Running the same code on a Win2k box fails - the value
returned for varField2 is the old (pre- my change) value, resulting in
an UPDATE statement that changes nothing. I have checked the ASP.NET
versions in both web servers - same. The only difference that I can
see is the OS. Aside from accomplishing this in another programmatic
means (I'm aware that it can be done in other ways), is there any
explanation for the different behavior in this code other than an
OS-related bg ?

Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles
GridView1.SelectedIndex = GridView1.EditIndex
Dim pkField1 As Integer =
Dim varField2 As Integer =
Dim strQuery = "UPDATE table1 SET f2 = " & varField2 & " WHERE f1 = "
& pkField1
SqlDataSource1.UpdateCommand = strQuery
End Sub



Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question