473,383 Members | 2,005 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,383 software developers and data experts.

About the Load Control Method

Hi,

Normally i use the LoadControl method following this way:
LoadControl("usercontrol1.ascx");

But its possible do something like this.

string control="usercontrol1.ascx";
LoadControl(control);

If not, could you recomend any solution to resolve my problem?

--
Thanks
Regards.
Josema
Nov 16 '05 #1
2 1903
Hi,

I see nowhere in the documentation that the parameter should be set at
compiler time

Did you tried it?

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Josema" <Je******@ocu.org> wrote in message
news:55**********************************@microsof t.com...
Hi,

Normally i use the LoadControl method following this way:
LoadControl("usercontrol1.ascx");

But its possible do something like this.

string control="usercontrol1.ascx";
LoadControl(control);

If not, could you recomend any solution to resolve my problem?

--
Thanks
Regards.
Josema

Nov 16 '05 #2
Hi, Ignacio i try to do it, and it works i can do a
LoadControl(variable)...

About the another post that i put in the forum this is my answer:

Hi Ignacio, Mi problem is exactly this (in Web)
I have:
- an aspx page
- an ascx control (Exercise1.ascx)
- an ascx control (Exercise2.ascx)

Inside the aspx page i have a placeholder to add a control dinamically.
This placeholder's name is Exercise.

In the aspx page i have this in the OnInit:

override protected void OnInit(EventArgs e)
{
if(Page.Session["Exercise"]!=null)
{
switch(Page.Session["Exercise"].ToString())
{
case "Exercise2.ascx":
Exercise2 Exercise2_=(Exercise2)LoadControl("Exercise2.ascx" );
Exercise.Controls.Add(Exercise2_);
break;
}
}
else
{
Exercise1 Exercise1_=(Exercise1)LoadControl("Exercise1.ascx" );
Exercise.Controls.Add(Exercise1_);
}
}

In the (for instance) Exercise1.ascx i have this in the onClick method
of a button:

private void ExerciseBtn_Click(object sender, EventArgs e)
{
//add into the session the next exercise to load
Page.Session.Add("Exercise","Exercise2.ascx");
}

If i click in the button inside the usercontrol twice the program works,
but i would like only to need one click.
Thanks.
Josema.

Thanks.
Kind Regards.
Josema.

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

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

Similar topics

1
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
8
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
15
by: Tee | last post by:
Hi, I have a base usercontrol with a method (blank method, no code), I have another few usercontrols that will inherit this base usercontrol, but I want to force all the usercontrol that...
5
by: eScrewDotCom | last post by:
www.eScrew.com eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is...
1
by: Moshfegh Hamedani | last post by:
Hi there, I found this question in Amit Kalani's preparation book for exam 70-15 (Developing Web Applications with C#). I think it's a very stupid question! It says the correct answer is A but...
0
by: Moshfegh Hamedani | last post by:
Hi there, I found this question in Amit Kalani's preparation book for exam 70-15 (Developing Web Applications with C#). I think it's a very stupid question! It says the correct answer is A but...
7
by: UJ | last post by:
I've got a page with a user control on it. While the page is loading, it needs to check certain conditions of the user object to enable/disable things on the screen. Currently in the page_load of...
6
by: Charles Law | last post by:
As a matter of practice, where would people put the following elements of object creation/initialisation: Create shared member objects Initialise shared member objects Create non-shared member...
2
by: Franky | last post by:
Threre is a Form containing a usercontrol In the form's Load event it references a usercontrol property, say, zz The first showdialog(formx) causes 1 usercontrol_load event 2 form_load event...
9
by: RvGrah | last post by:
I'm completely new to using background threading, though I have downloaded and run through several samples and understood how they worked. My question is: I have an app whose primary form...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.