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

Creating multiple RadGrids on the fly

4 Answers 151 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 13 Aug 2009, 11:47 PM

 

 

Hello i need to create from 1 to many new RadGrids based on the selection of an item/s from a static RadGrid, ie create a new "on the fly" RadGrid for every row item selected from a static RadGrid. I thought that by giving each new RadGrid a new RadGrid.ID, see below, that it might create a new RadGrid and that a new RadGrid would appear under the previously created RadGrids, ie appending new RadGrids under the previous created "otf" RadGrids. But i think i'm getting the understanding that i would need to create all of the potential new "otf" RadGrids in advance and manage the visibiliy of each one as needed. For example i would have to create a list of RadGrids in advance like RadGrid radgrid1; RadGrid radgrid2; RadGrid radgrid3; ......ect. Or is there a way to actually create a new RadGrid really genuinely from scratch on the fly?  

private
void DefineGridStructure2()

 

{

 

string txt = "TABLE1";

 

CustomQuery.

GetInfoSchema gis = new CustomQuery.GetInfoSchema();

 

 

string cs = "Data Source=DEVSQL.fhfb.gov;Initial Catalog=CustomQuery;Integrated Security=True";

 

 

DataTable dt = gis.GetTableInfo(cs, txt);

 

 

 

RadGrid grid = new RadGrid();

 

 

string sgridID="grid"+lblMessage.Text;

 

grid.ID = sgridID;

grid.AutoGenerateColumns =

true;

 

grid.DataSource = dt;

grid.DataBind();

Master.FindControl(

"mainContain").Controls.Add(grid);

 

 

string chktxt = lblMessage.Text;

 

}

4 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 14 Aug 2009, 01:47 PM
Hello Bob,

It is possible to create an instance of a RadGrid entirely in the code-behind - here you can read how to do this.
I also attach a sample project creating as many grids as specified in a RadNumericTextBox after a button is clicked. Please take a look at it and tell me is this the desired functionality.

Kind regards,
Mira
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Bob
Top achievements
Rank 1
answered on 14 Aug 2009, 04:53 PM
Thanks very much Mira really appreciate your  help have a great weekend you definitely made my weekend!

0
Bob
Top achievements
Rank 1
answered on 14 Aug 2009, 05:22 PM
Hi Mira i tried to run your solution and i think because we have an older version of Telerik its having some issues:

We are using version: 2008.3.1125.35

runtime: v2.0.50727

will i need a later version of Telerik to use some of the features in your solution please?

Thanks again Mira!
0
Bob
Top achievements
Rank 1
answered on 14 Aug 2009, 05:42 PM
ok Mira i may be ok i just pasted my versions into the Default and think i'm good now! thanks again!
Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Mira
Telerik team
Bob
Top achievements
Rank 1
Share this question
or