473,395 Members | 1,680 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,395 software developers and data experts.

Loading Custom Server Control from string ..

Hello!

I'm looking for the best way to load a custom server control defined by a
string (not a user-control - defined by the .ascx extension). The source for
the control is defined in e.g. a database and defines the namespace and
class for the control to be loaded.

Are we simply talking about loading assemblies here?

C#:
// Get source for control
string controlSrc = "SphereWorks.Controls.RSSFeedDisplay";

// Here's the interesting part (?)
Control loadedControl = ?

Controls.Add(loadedControl);

Thanks in advance. It's a quite interesting discussion, so I hope someone'll
join in =o)

--
venlig hilsen / with regards
anders borum
--
Nov 17 '05 #1
6 1275
Why not to load your custom control as any server control :

SphereWorks.Controls.RSSFeedDisplay MyControl = new
SphereWorks.Controls.RSSFeedDisplay();

MyControl .Visible = true;

Controls.Add(MyControl );


Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #2
Why not to load your custom control as any server control :

SphereWorks.Controls.RSSFeedDisplay MyControl = new
SphereWorks.Controls.RSSFeedDisplay();

MyControl .Visible = true;

Controls.Add(MyControl );


Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3
Hello!
Why not to load your custom control as any server control :

SphereWorks.Controls.RSSFeedDisplay MyControl = new
SphereWorks.Controls.RSSFeedDisplay();

MyControl .Visible = true;

Controls.Add(MyControl );


Thanks for the input, but I need to load (create an instance of) the control
from a string definition (coming from a database). The framework I've built
accepts both user controls and custom server controls, which - to your
knowledge I'm sure - isn't loadable using the LoadControl() method.

Any ideas? :-)

--
venlig hilsen / with regards
anders borum
--
Nov 17 '05 #4
Hello!
Why not to load your custom control as any server control :

SphereWorks.Controls.RSSFeedDisplay MyControl = new
SphereWorks.Controls.RSSFeedDisplay();

MyControl .Visible = true;

Controls.Add(MyControl );


Thanks for the input, but I need to load (create an instance of) the control
from a string definition (coming from a database). The framework I've built
accepts both user controls and custom server controls, which - to your
knowledge I'm sure - isn't loadable using the LoadControl() method.

Any ideas? :-)

--
venlig hilsen / with regards
anders borum
--
Nov 17 '05 #5
"Anders Borum" <na@na.na> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl...
Hello!
Why not to load your custom control as any server control :

SphereWorks.Controls.RSSFeedDisplay MyControl = new
SphereWorks.Controls.RSSFeedDisplay();

MyControl .Visible = true;

Controls.Add(MyControl );
Thanks for the input, but I need to load (create an instance of) the

control from a string definition (coming from a database). The framework I've built accepts both user controls and custom server controls, which - to your
knowledge I'm sure - isn't loadable using the LoadControl() method.

Any ideas? :-)


Take a look at Activator.CreateInstance.
--
John
Nov 17 '05 #6
"Anders Borum" <na@na.na> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl...
Hello!
Why not to load your custom control as any server control :

SphereWorks.Controls.RSSFeedDisplay MyControl = new
SphereWorks.Controls.RSSFeedDisplay();

MyControl .Visible = true;

Controls.Add(MyControl );
Thanks for the input, but I need to load (create an instance of) the

control from a string definition (coming from a database). The framework I've built accepts both user controls and custom server controls, which - to your
knowledge I'm sure - isn't loadable using the LoadControl() method.

Any ideas? :-)


Take a look at Activator.CreateInstance.
--
John
Nov 17 '05 #7

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

Similar topics

3
by: Joe Bloggs | last post by:
Does anyone know if its possible to pass parameters or the values of Request.QueryString from a web page to a custom control class? I'm using a C# Web Application. For Example I have Web Page1...
0
by: Anders Borum | last post by:
Hello! I'm looking for the best way to load a custom server control defined by a string (not a user-control - defined by the .ascx extension). The source for the control is defined in e.g. a...
2
by: Jay Walker | last post by:
I created a custom DataGridColumn based on Marcie Robillard's MSDN Article: Creating Custom Columns for the ASP.NET Datagrid...
1
by: Sanjay Pais | last post by:
I built a custom control for all the basic web.ui.controls like textbox, label, checkbox etc etc. I added my custom attribute called ApplySecurity to the html in the page. However, when I cycle...
12
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control...
0
by: ChopStickr | last post by:
I have a custom control that is embedded (using the object tag) in an html document. The control takes a path to a local client ini file. Reads the file. Executes the program specified in...
2
by: Michal Valent | last post by:
I would like to fire some custom server control event before Page_Load event like this (from the trace of an aspx page) : Trace Information Category Message From First(s) From Last(s) aspx.page...
1
by: =?Utf-8?B?TmVkaW0=?= | last post by:
Is it possible to use DataPager with custom loading classes (I use my own queries because of filtering and paging) and ListView control? ListView control is bound to a DataReader and DataReader...
4
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried...
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:
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: 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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.