How do you make gridview controls disappear?

Discussion in 'ASP .Net' started by COHENMARVIN@lycos.com, Apr 29, 2008.

  1. Guest

    I have a gridview control that is filled by the user adding rows to it
    with a submit button. Once he is totally through, I want to give him
    a 'success' message and then empty the grid. That should be easy,
    because the grid is full of records that are from a database where the
    select statement retrieves by using a compare parameter that is a
    session variable. In other words, something like this
    Select * from MyTable Where FormID = @FormID
    FormID is a session variable.
    So simply setting the session variable to something impossible, like
    -999, should clear the grids. But it doesn't. I tried doing a
    gridview.databind statement after the -999, but that did not help
    either.
    Finally I tried making the gridviews invisible using their 'visible'
    property - that also did not work!
    Is there some bug here? Is the page not refreshing?
    Can I force a page refresh?
    Thanks
    Marvin
     
    , Apr 29, 2008
    #1
    1. Advertising

  2. Nirosh Guest

    It seems you have a hard coupled system here.. I don't think -999 will work

    Anyway try to wrap the gridview with a div tag (run at server) and hide the
    div, when post back, that should work for sure

    --
    L.W.C. Nirosh
    <> wrote in message
    news:...
    >I have a gridview control that is filled by the user adding rows to it
    > with a submit button. Once he is totally through, I want to give him
    > a 'success' message and then empty the grid. That should be easy,
    > because the grid is full of records that are from a database where the
    > select statement retrieves by using a compare parameter that is a
    > session variable. In other words, something like this
    > Select * from MyTable Where FormID = @FormID
    > FormID is a session variable.
    > So simply setting the session variable to something impossible, like
    > -999, should clear the grids. But it doesn't. I tried doing a
    > gridview.databind statement after the -999, but that did not help
    > either.
    > Finally I tried making the gridviews invisible using their 'visible'
    > property - that also did not work!
    > Is there some bug here? Is the page not refreshing?
    > Can I force a page refresh?
    > Thanks
    > Marvin
     
    Nirosh, Apr 29, 2008
    #2
    1. Advertising

  3. If you are using declarative databinding with DataSourceID, you need to run
    select on the datasource to refresh the grid.

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    <> wrote in message
    news:...
    >I have a gridview control that is filled by the user adding rows to it
    > with a submit button. Once he is totally through, I want to give him
    > a 'success' message and then empty the grid. That should be easy,
    > because the grid is full of records that are from a database where the
    > select statement retrieves by using a compare parameter that is a
    > session variable. In other words, something like this
    > Select * from MyTable Where FormID = @FormID
    > FormID is a session variable.
    > So simply setting the session variable to something impossible, like
    > -999, should clear the grids. But it doesn't. I tried doing a
    > gridview.databind statement after the -999, but that did not help
    > either.
    > Finally I tried making the gridviews invisible using their 'visible'
    > property - that also did not work!
    > Is there some bug here? Is the page not refreshing?
    > Can I force a page refresh?
    > Thanks
    > Marvin
     
    Eliyahu Goldin, Apr 30, 2008
    #3
  4. Take them out to the parking lot and apply some dynamite.
    --
    Arne Garvander
    Certified Geek
    Professional Data Dude


    "" wrote:

    > I have a gridview control that is filled by the user adding rows to it
    > with a submit button. Once he is totally through, I want to give him
    > a 'success' message and then empty the grid. That should be easy,
    > because the grid is full of records that are from a database where the
    > select statement retrieves by using a compare parameter that is a
    > session variable. In other words, something like this
    > Select * from MyTable Where FormID = @FormID
    > FormID is a session variable.
    > So simply setting the session variable to something impossible, like
    > -999, should clear the grids. But it doesn't. I tried doing a
    > gridview.databind statement after the -999, but that did not help
    > either.
    > Finally I tried making the gridviews invisible using their 'visible'
    > property - that also did not work!
    > Is there some bug here? Is the page not refreshing?
    > Can I force a page refresh?
    > Thanks
    > Marvin
    >
     
    Arne Garvander, Apr 30, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Trint Smith
    Replies:
    13
    Views:
    1,493
  2. Colin Graham
    Replies:
    3
    Views:
    669
    Anders NorĂ¥s [MCAD]
    Dec 16, 2004
  3. hh
    Replies:
    0
    Views:
    2,850
  4. pete142

    how to make these warnings disappear?

    pete142, Apr 8, 2007, in forum: C Programming
    Replies:
    6
    Views:
    331
    pete142
    Apr 9, 2007
  5. Replies:
    1
    Views:
    360
    Jonathan Wood
    Jun 18, 2008
Loading...

Share This Page