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

R

Rick

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.RowUpdating
GridView1.SelectedIndex = GridView1.EditIndex
Dim pkField1 As Integer =
GridView1.Rows(GridView1.SelectedIndex).Cells(1).Text
Dim varField2 As Integer =
CType(GridView1.Rows(GridView1.SelectedIndex).Cells(2).Controls(0),
TextBox).Text
Dim strQuery = "UPDATE table1 SET f2 = " & varField2 & " WHERE f1 = "
& pkField1
SqlDataSource1.UpdateCommand = strQuery
SqlDataSource1.Update()
End Sub

Thanks.
Rick
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top