Results 1 to 11 of 11

Thread: Problem refreshing e datagrid

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2003
    Posts
    68

    Problem refreshing e datagrid

    Hi, everybody. I got a small problem with the datagrid, when user click on one of e record from the datgrid, it will show e record displaying in e textbox. When i edit or delete on e record, then i close e form. How come my datagrid wont refresh, n display the amended record?
    Can u pls help mi? I got refresh e datagrid but it wont helps at all.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Refresh method won't work but as a workaround , you need to re-iterate the Grid . So , better you call the procedure that you use to fill the Grid again .

  3. #3
    Lively Member
    Join Date
    Sep 2003
    Location
    Chicago, IL
    Posts
    64
    Are you saving the changes to the datatable/datarow/dataset? If not, you wont ever see changes in the data that is populating your controls. After you make changes to a textbox contents you need to update the datatable with the changes and then save the changed rows to the database via a dataAdapter. If you just change it in the datatable and dont post it to the database, the change will only be reflected in memory and will be lost when the form is destroyed or the datatable goes out of scope.

    Please give me some more details of what you are trying to accomplish and I can get you some code to do it.

    If you have a datagrid bound to a datatable, any changes to the datatable will be reflected in the datagrid automatically. if you arent seeing them, you arent updating your datatable with the changes.
    Mike Stammer

  4. #4
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Originally posted by Pirate
    Refresh method won't work but as a workaround , you need to re-iterate the Grid . So , better you call the procedure that you use to fill the Grid again .
    Refresh method of datagrid works, but it is not intended to refresh the datasource, it just invalidates and repaints the control. To refresh the data you may refresh the datasourse or the currency manager.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  5. #5
    Lively Member
    Join Date
    Sep 2003
    Location
    Chicago, IL
    Posts
    64
    refresh is useless unless the changes are persisted to the database at some time. No sense in refreshing from the database if the updates were never sent there. This guy needs to let us know what he has so far.
    Mike Stammer

  6. #6
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    we were talking about datasource of the datagrid not the database.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Lunatic3
    Refresh method of datagrid works, but it is not intended to refresh the datasource, it just invalidates and repaints the control. To refresh the data you may refresh the datasourse or the currency manager.
    Which is what I'm saying ....

  8. #8
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Originally posted by Pirate
    Which is what I'm saying ....
    But you said it doesn't work, so he may think that the mission of refresh method in the datagrid is to refresh the data but due to some problems it does not work, which is not the case.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  9. #9
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Lunatic3
    But you said it doesn't work, so he may think that the mission of refresh method in the datagrid is to refresh the data but due to some problems it does not work, which is not the case.
    Yes , I did say that because he mentioned that it didn't work (refresh method) . So I put a solution in his hand that works usually .

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Sep 2003
    Posts
    68
    I am saving under dataset. How do i refresh the changes for the dataset? Can u show mi some codes...

  11. #11
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I created this demo to show Chong how I do refreshing . Try it out .
    Attached Files Attached Files

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