-
Clearing Data Grid
Version: 2003
The datagrid processing works. The problem is that when I make a second selection to populate the data grid, the existing data does not get cleared. I have tried clearing the table, clearing the select command statement, and various other techniques. Nothing works.
Does anybody have any ideas.
Thanks in advance.
-
Re: Clearing Data Grid
Have you tried calling Refresh on the datagrid after refreshing the data?
-
Re: Clearing Data Grid
Mr Dolot,
dgECLLines.TableStyles.Clear()
dgECLLines.Refresh()
dgECLLines.TableStyles.Add(aGridTableStyleECLLines)
dgECLLines.DataSource = ds
dgECLLines.DataMember = "ECLL02"
As you can see, the refresh is there, but still does not clear. I am open to any suggestions.
Thanks for Trying.
-
Re: Clearing Data Grid
I would try putting the refresh after the setting of the dataMember.
-
Re: Clearing Data Grid
Made the change- same results - added the items from second requested to bottom of first request.
dgECLLines.TableStyles.Clear()
dgECLLines.TableStyles.Add(aGridTableStyleECLLines)
dgECLLines.DataSource = ds
dgECLLines.DataMember = "ECLL02"
dgECLLines.Refresh()
-
Re: Clearing Data Grid
And this is the same code that gets called the first time and it works, but not the second time?
-
Re: Clearing Data Grid
I set the table in a different data set and I changed the order of the statements and that seems to have solved the problem.
Thanks for the help.
-
Re: Clearing Data Grid
You do realize that all you are clearing is the table style... not the data, right? Best way I found to get it to clear is to set the DataSource to nothing, call grid.rows.clear, then reset the dataasource, the datamember (although I'm usually jsut binding a datatable, making this moot) and calling .Refresh.
-tg
-
Re: Clearing Data Grid
Yes is do realize the I am clearing the table style. Part of the code that I did not send you was dealing with the table style.
I really appreciate all you time.
Thanks again