0

I have a few radgrids created on page, lets say 3.

Radgrid1
Radgrid2
Radgrid3

And each of them are assigned their own datasource, lets say the following.

Radgrid1.datasource = ds1
Radgrid2.datasource = ds2
Radgrid3.datasource = ds3

I'm trying to figure out how to delete them and then resync their numbering.

I'm trying the method.

Radgrid1.Dispose()

But that doesn't do anything.

Anyone have any ideas?

Brad Hazelnut
  • 1,603
  • 5
  • 21
  • 33

1 Answers1

1

Not really sure what you mean by "resync their numbering", or why you're trying to dispose of the existing grids, but you can just reassign the data sources to different grids:

Radgrid1.DataSource = ds2;
Radgrid1.DataBind();

Radgrid2.DataSource = ds3;
Radgrid2.DataBind();

...which will update the grids with the new data sources.

Mathew Collins
  • 376
  • 3
  • 14
  • thats actually a really good idea, but what about the last grid, if the datasource is blank, it will just show a big line where the grid would supposedly be if it had a datasource, how would i delete that grid? – Brad Hazelnut Oct 02 '13 at 13:27
  • Can you not just either a) not add the grid to the page (if it's generated in code), or b) set the grid.Visible = false? – Mathew Collins Oct 02 '13 at 16:42
  • i was thinking about setting it to false, but the issue is on the last page, i want to loop through all the grids and grab all the data and insert into a db, so the issue is, that if i set it to false, then it will still loop through that grid – Brad Hazelnut Oct 02 '13 at 17:04
  • 2
    While looping just the whether the Datasource is null or not, then you can avoid the last grid – Saritha.S.R Oct 03 '13 at 04:36