Add user controls to programmatically specified location

K

Kiki

Add user controls to programmatically specified location

I have some data about a control I'm calling from a page. This control
will be load n-th times on the page but only one option will be
displayed at any time. I would like to place these controls in divs
that I can then decide to display or hide according to user selection.
This is the code at the moment:
foreach (GameDetails gameAttributes in gameDetails)
{
Game gameControl = (Game) LoadControl("UserControls/Game.ascx");
gameControl.HRef = gameAttributes.HRef;
gameControl.Title = gameAttributes.Title;
this.phGameDetails.Controls.Add(gameControl);
}

Instead of placing the controls in phGameDetails, I would like to
specify a div and its id for each control that will potentially be
loaded.
I know i could get all the divs and then place the controls there as
they load but i won't know how many divs i'll need until run-time.

Can anyone help? Thank you for your time.

Kiki
 
K

kiki christie

Hi William,
i need the div so i can have it's id.. i want to load all game controls
at page_load but keep them hidden. so when the user selects a game from
the menu, i'd like to display the game control on the same page to
display some info about the game.
i did add an id on the control but it's nowhere to be seen on view
source. therefore i can't manipulate its visibility with javascript..

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top