in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

Empty ASPxGrid

Last post 11/20/2008 5:24 PM by Mehul Harry (Developer Express). 5 replies.
Page 1 of 1 (6 items)
Sort Posts:
Previous Next
  • 11/19/2008 5:39 PM

    Empty ASPxGrid

    We have a page that allows the user to search on a number of objects. The user selects what they want to search for (address, hydrant, municipality) and then they select or type their search criteria (100 Street, MyTown, etc.) and the grid is populated with the results.

    I want to empty the grid if the user wants to do another search. I thought grid.Clear(), grid.Empty(), grid.DataSource.Clear() might work but I don't see anything like that in the intellisense.

    How do I empty the grid?

  • 11/19/2008 8:52 PM In reply to

    Re: Empty ASPxGrid

    Hi,

    If you have a clear button then try setting the datasource of the grid to nothing. 

  • 11/20/2008 12:45 PM In reply to

    Re: Empty ASPxGrid

     I tried:

    grid.DataSource = ""

    grid.DataBind()

    when the user selects a new search but I'm still getting the same error. 

     

    The user select his first search (example: search for an address), the grid returns a number of results (with columns like civic, street, municipality, postal code). Then the user chooses another search (example search for a hydrant) now the grid fails because it can't find civic.

    How do I reset the grid so I start from scratch again?

    We're building everything on the fly, all of the grid properties are set in the code, not in the aspx.

  • 11/20/2008 2:41 PM In reply to

    Re: Empty ASPxGrid

    Hi,

    Check out how the databinding is done in this sample: How to filter the grid using the outside combobox

     

  • 11/20/2008 4:25 PM In reply to

    Re: Empty ASPxGrid

    Answer

     Thanks for your response.

    I ended up using grid.columns.clear() before the databind. The columns that we show in the grid are always different.

  • 11/20/2008 5:24 PM In reply to

    Re: Empty ASPxGrid

    Ah, glad you found a solution that works for you.

Page 1 of 1 (6 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED