GridView does not refresh after insert with DetailsView

Discussion in 'ASP .Net' started by needin4mation, Oct 9, 2006.

  1. Not sure what I'm doing wrong here. I have a gridview and a
    detailsview. The detailsview is set to insert by default. When I
    insert data the detailsview it works. The data goes in the database.
    The gridview on the page, however, never refreshes to show the new row.
    The sql for the gridview defaults to a LIKE % and when the page first
    loads I can see all the records.

    If after I try an edit a gridview record and delete or cancel, then my
    new record will show up (it queries correctly.)

    What have I done wrong?

    Thank you for any help.
    needin4mation, Oct 9, 2006
    1. Advertisements

  2. Does your DetailsView have an Item Inserted Event? If so, place a call to
    the Grid View's DataBind() method in there. You may want to do the same
    with the Item Updated and Item Deleted events.
    Mark E. Hansen, Oct 11, 2006
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.