Refreshing GridView after update - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Refreshing GridView after update

Memphis15Memphis15 Posts: 15Member
Hello all,

I have an ASP.Net webpage (using VS 2008 to develop it) on the page is some textboes, dropdownlists etc. and a gridview. The gridview datasource is an accessdatasource so im using a access database.

Now when the user selects a row in the gridview the information from that row is populated into the textboxes and dropdownlists so that they can make any changes.

The problem im having is when they hit save changes and it updates the database i can't get the gridview to refresh instantly, i have to either refresh the page manually, or go to a different page on the gridview and then back to it.

I have tried using the DataBind() method of the gridview and also tried Response.Redirect to the same page but neither worked.

Any help is much appreciated, thanks in advanced.
-M3mph15

Comments

  • bradwangbradwang Posts: 197Member
    Are you using any cache?

    And are you sure that the changes have actually been saved to the DB?

    If so, I think re-load the page programmatically will solve your issue.


    [color=Green][size=1][b]Brad Wang - .NET Freelancer from China
    MSN: [email protected]
    Skype: brad_wang[/b][/size][/color]
  • Memphis15Memphis15 Posts: 15Member
    Hey,

    Yes i am sure that the changes have been saved to the database. Because if i manually refresh the page or if i sort the gridview by a certain column it shows the changes, i just can't seem to get it to show the changes automatically.

    -M3mph15
  • kittuemanikittuemani Posts: 1Member
    Hey,
    Gridview.Bind() is not sufficient to update the grid. You have to bind
    latest dataset to u r grid also.

    Gridview1.Datasource=ds;
    Gridview1.DataBind();

    i hope it works.

    Vijay Krishna .E
    www.urasp.net

  • pankajmkpankajmk Posts: 7Member
    : Hello all,
    :
    : I have an ASP.Net webpage (using VS 2008 to develop it) on the page
    : is some textboes, dropdownlists etc. and a gridview. The gridview
    : datasource is an accessdatasource so im using a access database.
    :
    : Now when the user selects a row in the gridview the information from
    : that row is populated into the textboxes and dropdownlists so that
    : they can make any changes.
    :
    : The problem im having is when they hit save changes and it updates
    : the database i can't get the gridview to refresh instantly, i have
    : to either refresh the page manually, or go to a different page on
    : the gridview and then back to it.
    :
    : I have tried using the DataBind() method of the gridview and also
    : tried Response.Redirect to the same page but neither worked.
    :
    : Any help is much appreciated, thanks in advanced.
    : -M3mph15

    Hi,
    You can re bind the DataGrid and see

    Thanks
    http://www.dotnetspark.com

Sign In or Register to comment.