update problem in DataGrid's UpdateCommand method

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default update problem in DataGrid's UpdateCommand method

    Hi, anyone can help me to solve this little problem that
    i've spent a lot of time to solve it!! but i can't!!!!

    actually, i use a DataGrid, and i'd like to save the
    changed data! ( this is just a trial method and i'll
    use this method with a more complique method later,
    that's why i can't use MxDataGrid)

    but each time, DataGrid save the original data, not the
    one after changed in the Textbox!!!
    i've used Database Update Method!!!
    but it can't save the new data in the database!
    even though i use a Label6 to show out the changed data,
    it can't show the new data too!!!

    here is the code!!
    anyone can give me a hand???

    thanks!!!

    Dawn
    ------------------------------
    Sub MyDataGrid_UpdateCommand(sender As Object, e As
    DataGridCommandEventArgs)
    Dim Ucode As TextBox = e.Item.Cells(1).Controls(0)
    Dim Unom As TextBox = e.Item.Cells(2).Controls(0)
    Dim Uetage As TextBox = e.Item.Cells(3).Controls(0)
    Dim Ubureau As TextBox = e.Item.Cells(4).Controls(0)

    Dim Upid As integer = e.Item.ItemIndex + 1
    Dim Upcode As String = Ucode.Text
    Dim Upnom As String = Unom.Text
    Dim Upetage As String = Uetage.Text
    Dim UpBureau As String = Ubureau.Text

    Label6.Text= Upid & "--"& Upnom &"---" & Upcode & "--

    UpdateSite(5,Upnom,Upcode,Upetage,UpBureau)
    MyDataGrid.EditItemIndex = -1
    BindGrid
    End Sub


    dawn Guest

  2. Similar Questions and Discussions

    1. DataGrid1 UpdateCommand calling DataGrid2 UpdateCommand
      When the UpdateCommand gets called on a DataGrid(1) i need to call the UpdateCommand on DataGrid(2), and when complete proceed with the reminder on...
    2. How to add javascript onClick attribute to datagrid's edit template (update command)?
      How to add javascript onClick attribute to datagrid's edit template (update command)? any suggestions?
    3. Datagrid Updatecommand problem!! Urgent
      Hi! I have a datagrid and i want to update new values after editing datagrid. i am using following code; tb = CType(e.Item.Cells(1).Controls(0),...
    4. new datagrid's problem
      my table has total 3 columns like emp_id(primay key),emp_name emp_address i m populating my datagrid at run time successfully . now i add...
    5. DataGrid's UpdateCommand event handler and CancelCommand handler problem
      I am having the same problem: the wrong event handler is being fired when column headings and page changes are clicked. I am using the datagrid...
  3. #2

    Default Re: update problem in DataGrid's UpdateCommand method

    you need to trace through the code and check the values passed into the 4
    Strings you're pulling off the textboxes, then step into the UpdateSite
    function to check this does what it says on the tin, i suspect it's in this
    method that your problem lies.

    Dan.

    ps. it's worth noting your first parameter is "5" in the UpdateSite...
    should this perhaps be Upid?


    "dawn" <bigheaddawn@yahoo.com> wrote in message
    news:305801c3550d$1000ce90$a001280a@phx.gbl...
    > Hi, anyone can help me to solve this little problem that
    > i've spent a lot of time to solve it!! but i can't!!!!
    >
    > actually, i use a DataGrid, and i'd like to save the
    > changed data! ( this is just a trial method and i'll
    > use this method with a more complique method later,
    > that's why i can't use MxDataGrid)
    >
    > but each time, DataGrid save the original data, not the
    > one after changed in the Textbox!!!
    > i've used Database Update Method!!!
    > but it can't save the new data in the database!
    > even though i use a Label6 to show out the changed data,
    > it can't show the new data too!!!
    >
    > here is the code!!
    > anyone can give me a hand???
    >
    > thanks!!!
    >
    > Dawn
    > ------------------------------
    > Sub MyDataGrid_UpdateCommand(sender As Object, e As
    > DataGridCommandEventArgs)
    > Dim Ucode As TextBox = e.Item.Cells(1).Controls(0)
    > Dim Unom As TextBox = e.Item.Cells(2).Controls(0)
    > Dim Uetage As TextBox = e.Item.Cells(3).Controls(0)
    > Dim Ubureau As TextBox = e.Item.Cells(4).Controls(0)
    >
    > Dim Upid As integer = e.Item.ItemIndex + 1
    > Dim Upcode As String = Ucode.Text
    > Dim Upnom As String = Unom.Text
    > Dim Upetage As String = Uetage.Text
    > Dim UpBureau As String = Ubureau.Text
    >
    > Label6.Text= Upid & "--"& Upnom &"---" & Upcode & "--
    >
    > UpdateSite(5,Upnom,Upcode,Upetage,UpBureau)
    > MyDataGrid.EditItemIndex = -1
    > BindGrid
    > End Sub
    >
    >

    Daniel Bass Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139