How to use a web user control from one web app in another web app?

I have a production web app project (at work) that has custom web user controls in it.

I have another web app project for experimenting and I want to use some web controls from the production web app. The big trick is that I need to load the controls dynamically.

LoadControl() doesn't seem to work - it complains about loading controls from a different application. I also tried adding a project reference to the production web app and using "UC1 newUC = new UC1();" and then "this.Controls.Add(newUC);", but the controls (like TextBoxes) on the web user control don't seem to exist on the new UC1s.

If it would help, I can probably quickly hack together a sample similar to my work project and post all code for review.

Any and all advice appreciated!

Thanks in advance,
Andrew
0
AndrewJMarshall
7/2/2005 1:32:01 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

2 Replies
1315 Views

Similar Articles

[PageSpeed] 9

What you may need to explore here, is how to make Custom Controls using .Net. It's fairly easy when you have the right tools, like VS.Net, but not rocket science difficult without it either. If you often find yourself needing a certain Pattern of different Controls used in a certain context, creating a Custom Controls out of these will often simplify your work tremendously. A custom Control consisting of different Controls grouped together like this is called a Composite Control. Create the Control, inheriting from most suitable Class (e.g. the Webcontrol or Control Class), add your own Properties, Method, Delegates and Events to your Control, compile the Code and add it to your ToolBox (if you're using VS.Net), and you're good to go. If you know nothing about making Custom Controls, visit this link;

http://aspalliance.com/345


It's a great primer for anybody who wants to build their own Controls.
Regards

Andre Colbiornsen
---------------------------------
Seventh Day
Råbygatan 1A,
SE-223 61 Lund
Sweden
Mob.: +46-(0)708-97 78 79
Mail: info@seventhday.se
--------------------------------
0
adec
7/2/2005 1:55:55 AM
Terribly sorry, I seem to have scanned your post a bit too fast. To be able to use the Custom Controls like you want, you need to get hold of the Assembly containing the compiled Code for the Control/s. In your case I would probably include the Assembly in your application's /Bin folder 'using' the Control's Namespace in the Pages where you intend to include the Control/s.

If the Control/s  will be used extensively, you should consider registering the Assembly in the GAC (Global Assembly Cache) of both your Development Machine and your Production Server (if possible).
Regards

Andre Colbiornsen
---------------------------------
Seventh Day
Råbygatan 1A,
SE-223 61 Lund
Sweden
Mob.: +46-(0)708-97 78 79
Mail: info@seventhday.se
--------------------------------
0
adec
7/2/2005 2:07:21 AM
Reply:

Similar Artilces:

I have a web user control being used by another web user control, but the one being used will not display the labels in the resx file.
I am using DotNetNuke version 3.13 (might be 3.013) on a Window's XP machine, SP2. I have what I find to be an extremely odd situation. I have a project called TDS.Controls. This project is a web control library. Each control has its own resx file, which is located in the App_LocalResources directory. Each control inherits from Framework.UserControlBase, just like DotNetNuke's User control in DNN\Controls\User.ascx.vb. As a matter of fact, this control is doing the exact same thing I am trying to do. It is a web user control with its own resx file being used by another web user control (See ...

web web web
Name: bahadir Email: sensiz_olmuyor_t1_at_hotmail.com Product: Firefox 2 Beta 2 Summary: web web web Comments: web sayfası yapmak Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.8.1b2) Gecko/20060821 Firefox/2.0b2 ...

Web Apps vs. Web Sites (was: Universal Navigation for Web Apps)
On Wed, Mar 14, 2012 at 12:58 PM, Justin D'Arcangelo <justindarc@gmail.com>wrote: > there needs to be a differentiation between > web sites and web *apps*. > While we might be able to describe characteristics that conceptually separate a "web site" from a "web app", I think in reality they will exist on a continuum. Chris Jones is right that we need more data from actual app developers on this, but I can provide some anecdotal evidence by telling the story of a web app I worked on which got listed in a web app store. I worked on a web-b...

Using multiple web.configs with different web apps in the same web folder.
How do I tell a web application to use a specific web.config file instead of referencing the root web apps web.config file? Example: In IIS i have this setup:My Server  Web Sites     Default Web Site (this has web.config with a reference to a HTTP Handler)     My Http Handler           My Sub Web             < --- This sub web is looking for the http handler in this web hope that makes sense.   shawn use location elem...

Passing object from one web App to another web App and back (webRequest maybe) can you help?
Hi Guys not sure if the right place for this. I am STUCK!!!! I need to pass data from one web application to another web Application and back Before implementing in the real work that I am doing , i have build a quick demo 2 Web Application Projects (WebAppA and WebAppB) 01 Class Library With 2 ClassesRequestClass (1 Property amountToPay=10)ResultClass (1 Property bool IsSuccess) WebAppA.MakePayment.aspx has method call Pay ResultClass rslt=payMethod(requestclass)  // this should be a call to WebAppB WebAppB should return a result back .How can I do it??????   I have ...

convert java web app 2 .NET web app
Hi, i am able to convert java console app to .NET console app.but i am unable to convert java web based application to .NET web based application. can u give me some idea as to how to convert that. Thanks in advance,nizam. I believe the technical phrase is.. rtfm?  lol.  you're going to have to do it the hard way.  JSP operates on a different theory of web development than asp.net/asp.net 2.0Kay LeeMySpace.com - http://www.myspace.com/kragieInfrastructure GroupMySpace.com- Code to live, but Live to code. Try these two links for sample code and free book from Microsoft, ...

Best INTRANET option; one web app or mulitple web apps
My company has several small client/server apps and they want then move to asp.net.  Some of these apps may call each other pages and share some pages for searching data.  The main question is: Best option or practice--- Do we create multiple virtual directories or just one virtual directory and split out the apps in their own separate folders?  If we use one large app, are you able to compile just a part that was changed or do you have to bring down the entire site?  Will sub directories work the best? Any opinions or directions to a white paper would be greatly apprec...

Calling local client apps via web form/web app.
Hello all,I am not sure if this is the correct area to ask this, so excuse me ifI posted in wrong area. I'm a bit of a newbie to this but I was wondering if I can call a local app. via a web application.  A friend suggested looking into ActiveX controls, but I am not familiar with them.  Also what other alternatives are there beside using ActiveX? I read about using Flex and Applets but again I don't know which would be my best option and what kind of security issues I may be dealing with?  If anyone can inform me or suggest a reference or book I would appr...

How do I merge web services' app.config with web app's web.config? Help!!
I have a web application project that uses a separate class library containing web service references (service layer). I want to be able to configure the web reference URLs dynamically and I know you can set this up by setting the URL behavior to  'Dynamic', etc, etc. The problem is VS2005 puts the URLs in the project's app.config file. When the class library becomes a DLL component, I have no way of accessing the app.config file.Is there a way to make the web reference project to look for the URLs in the web.config instead of its app.config? Or is there a way to merge this app.config w...

Web User Control to Web User Control...
Hi, I have 2 User controls on a page and want Control1 to call a method of Control2. Is this Possible? Example: Con1 = Datalist showing products, each with a Quantity Box and a Button. Con2 = Repeater showing Cart Preview (name, Price) in page.aspx. When I click on the button on the DataList in Con1 it adds the item into the Session based Cart. However it does not update the Cart Preview. I need to call BindPreview() in Con2 in order to update the Cart Preview... Does that make sense? argh! any help much appreciated! PeteWeb Design Nottingham, UK Well I can call BindPreview() from m...

Using Multiple Web.Config for mutliple web apps sharing a web site as virtual directories
I have a web site on IIS 6.0 Windows 2003 Server. I have created several virtual directories to point to other .net projects that I wish to use in the website. The main site, which was made in C#, has a line in the web.config that allows the use of VB by defining a speical code directory. Now, when I attempt to use the other applications they throw this error. It looks like they are all sharing the main web.configParser Error Message: The code subdirectory '/Forum/App_Code/VBCode/' does not exist.Source Error: Line 62: <!-- for SIP asp.net forum -->Line 63: <codeSubDirect...

Run Vb.net Web app using Web Harpoon
Does anyone know what Begin Tag and End Tag to use to run a VB.Net web App in Web Harpoon? We are experiencing errors trying to run the app. Error --> The state information is invalid for this page and might be corrupted Thanks,   Erik...

Regular web app or Mobile web app.
Im targeting PocketPCs only (w/PocketIE). I changed the web.config to cookieless="true" and placed buttons with events. Im getting the postbacks and everything looks good so far... Can we just use this intead of the mobile web app project? Whats the difference? Duke You can use either a regular Web app or a mobile app, presuming you are targeting ONLY Pocket IE. Pocket IE accepts HTML.Starting with ASP.NET 2.0? Look at:Programming Microsoft Web Forms My Blog...

Web Form and Web User Control
Hello, I have a Web User Control (ascx) that includes a button. This button has an onclick event method. This Web User control is included into a Web Form. (thru LoadControl). However, when I click on the button, the event method is not executed. What should I include in order it works fine? Thanks in advance. GAA. Using Loadcontrol is using dynamic controls and when using dynamic controls you must recreate the same dynamic controls ono postback to econstruct the page control tree. It is best if you do this during the Page PreInit event. How complex are your controls ...

Web resources about - How to use a web user control from one web app in another web app? - asp.net.web-forms

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Firefighters battle out of control bushfire in Bullsbrook
Around 70 firefighters are battling an out of control bush-fire in Bullsbrook.

Firefighters battle out of control bushfire in Bullsbrook
Around 70 firefighters are battling an out of control bush-fire in Bullsbrook.

Firefighters battle out of control bushfire in Bullsbrook
Around 70 firefighters are battling an out of control bush-fire in Bullsbrook.

Firefighters battle out of control bushfire in Bullsbrook
Around 70 firefighters are battling an out of control bush-fire in Bullsbrook.

As it happened: Fire crews battle out-of-control blazes in southern states
Emergency warnings are in place for a fire burning in Victoria's north-east while fire crews also tackle blazes in ACT, NSW and Tasmania.

Dell Issues Patch For Content Adaptive Brightness Control On The XPS 13
... issues, as all devices do. One that was very frustrating to deal with during the review was the aggressive Content Adaptive Brightness Control ...

Tencent Holdings Takes Full Control of 'League of Legends' Developer Riot Games
Breitbart News Tencent Holdings Takes Full Control of 'League of Legends' Developer Riot Games Breitbart News Riot Games, the creators of ...

China's Xi on cyberspace control
Chinese President Xi Jinping defended his country's right to censor Internet content, signaling confidence in the strategy.

Taliban forces take control of key district in Afghanistan's Helmand province
CNN Taliban forces take control of key district in Afghanistan's Helmand province CNN Kabul, Afghanistan (CNN) Taliban forces have taken almost ...

Resources last updated: 12/22/2015 6:58:22 AM