This is a migrated thread and some comments may be shown as answers.

Add/Remove RadGrid from PlaceHolder

1 Answer 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jonathan Medley
Top achievements
Rank 1
Jonathan Medley asked on 18 Jun 2008, 08:27 PM
I have a web form that I would like to show multiple RadGrids each with a different data source. Only one grid should be displayed at a time depending on a user action. I've been able to get this to work using Ajax but with multiple PlaceHolders. I just make the unneeded PlaceHolders visible=false. I would like to use a single PlaceHolder.

I'm building my grid structure and setting up ajax programmatically. So, in the Page_Init I build the grid structure for all my grids. I need to do this because in Page_Load I'm adding all the ajax settings to the controls, otherwise all the controls will be null.

When the user action occurs I clear the PlaceHolder, build the specific grid, and add the new grid to the PlaceHolder. The problem is the previous grid is still there and the two grids appear, not just the recent one. It seems like the RadGrid is not clearing from the PlaceHolder when I do this.PlaceHolder1.Controls.Clear().

Any ideas?

Thanks
Jonathan

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 20 Jun 2008, 09:23 AM
Hello Jonathan,

Try clearing your Content holder conditionally in Page_Init if you are clearing it at Page_Load. Additionally, you may try refreshing your page after clearing the controls using:

Page.Response.Redirect(Page.Request.Url.ToString(), true); 


Kind regards,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Jonathan Medley
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or