473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Add user controls to programmatically specified location

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
Nov 18 '05 #1
2 1554
If the game control has a visible property why would you need the div?
--
William Main
"Kiki" wrote:
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

Nov 18 '05 #2
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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Shane Molton | last post by:
I have a few user controls and I don't want to add them to the main form. I simply want to be able to spawn them like pop-up windows I added them to my project and call show(), but nothing...
2
by: Technical Group | last post by:
Friends, Can anybody help me out by sending a piece of C# code showing how to add an active directory user to a particular user group? If the group does not exist, then create it. Thanks in...
1
by: Martine | last post by:
Hi there! I have a problem with programmatically adding user controls to my mobile webforms. If I load my usercontrol programmatically (in the Page_Load), the object is instantiated, I have...
0
by: Jeff Schaefer | last post by:
What I want to know is this: Is it possible to programmatically manipulate a custom property of a user control for which <%@ OutputCache ... > has been included? If so, then how? My brief code is...
8
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As...
4
by: | last post by:
I have a "form field highlight" javascript that I've added to some of my ASP.NET forms using the following syntax: body.Attributes.Add("onClick", "highlight(event);");...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
3
by: Terry Olsen | last post by:
I'm trying to add a domain user to a local group using the code below: Dim LCL As New DirectoryEntry("WinNT://" + Environment.MachineName + ",computer") Dim DOM As New...
2
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.