Results 1 to 4 of 4

Thread: Datagrid Update Trouble [Resolved]

Threaded View

  1. #1

    Thread Starter
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Datagrid Update Trouble [Resolved]

    Well I'm experiencing something funky. For some reason the UpdateCommand event is showing the data as it was before it was edited. I have it working on another project, but in that one I know the fieldnames at designtime (not that it sould matter). Now in another project if I set a breakpoint in the UpdateCommand then go and edit say some text from "Weak" to "Weakling" and press update it still says that the control reads "Weak"???? I don't get it. Anyone else having this trouble.
    VB Code:
    1. Private Sub dgCurrent_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgCurrent.UpdateCommand
    2.         Dim ds As DataSet = ViewState("Data")
    3.         Dim cnt As Integer
    4.         Dim cntMax As Integer = ds.Tables(0).Rows(e.Item.ItemIndex).ItemArray.Length - 1
    5.         If cntMax < 0 Then cntMax = 0
    6.         For cnt = 0 To cntMax
    7.             ds.Tables(0).Rows(e.Item.ItemIndex)(cnt) = DirectCast(e.Item.Cells(cnt + 2).Controls(0), TextBox).Text
    8.         Next
    9.         dgCurrent.EditItemIndex = -1
    10.         ViewState("Data") = ds
    11.         SaveData()
    12.         LoadData()
    13.     End Sub

    The part that says 'DirectCast(e.Item.Cells(cnt + 2).Controls(0), TextBox).Text' should return "Weakling" but still returns the value as if it were not edited ("Weak").
    Last edited by Edneeis; Jul 23rd, 2003 at 12:15 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width