global.asax, object tag and custom web control behind code

I've got defined an object in global.asax like this: <object id="G_obj" class="MyClass" scope="Application" runat="server" />

and I want to access the global object in a custom web control file CS:
public class admin : Control {
protected override void Render (HtmlTextWriter writer) {
writer.Write(G_obj.Text);
}
}
But, I can't compile that CS file, because compiler don't know anything about a global object G_obj, which will be defined in global.asax in a concrete application.
???
In the other way I can't test a syntax: Application["G_obj"] because Application isn't defined in derived class Control.
0
placek_martin
11/17/2003 1:49:04 PM
asp.net.config-deploy 12495 articles. 0 followers. Follow

0 Replies
932 Views

Similar Articles

[PageSpeed] 22

Reply:

Similar Artilces:

global.asax object tag
I'm attempting to create an ASP.NET application that acts as a client to a WCF service.  The goal is to instantiate the service client object generated by svcutil.exe and make it globally accessible to any code in my ASP.NET application - that is, one of these objects for the entire application regardless of sessions.We'll pretend that the client class name is "svcClientClass" and the app named "ConsumeService"I've created a server-side object tag in Global.asax, making the contents of Global.asax as follows: <%@ Application Codebehind="Global.asa...

Web Custom Control within a Web Custom Control
I was wondering if this can be done and how. I've created a simple custom control that displays a header which is my first custom control. So I'm just a baby when it comes to this.. Within the header I currently have a property for breadcrumbs which is a string. What I would like to do is have the breadcrumb property  be a Link Button List. I did find a custom control of a Link Button List which is exactly what I wanted. My question is how can/do  I include this into my custom control? Can it done? How? Please help? I'm at a lose here.   Susan You should be able to do ...

Visual Studio .Net - Global.asax
How do I get the IDE to recognize my custom object tag? I want to have a global reference thats easy to use of a class that I have built.. and I can't get the IDE to recognize this from the file, so therefore when it builds, it whines because it can't find it.... <object id="Catalog" runat="server" class="DevelopStuff.SellStuff.Business.ProductCatalog" scope="Application" /> in my index.aspx page.. i reference it like this .... Catalog["ID"] = product; .... the IDE spits back.. \\server\wwwroot$\Sell...

Web Deployment Project, User Controls, and Code Behind
I'm trying to create a control library to use within a web application.  The control library contains user controls (the controls extend UserControl).  IF I put the code for the controls in a code-behind file, the controls do not show up in the web site consuming them.  If, however, I put the code for the codes in-line (code within <script runat="server"/>), the controls display fine.Now I know this is nit-picky, but the code-behind is simply much neater and, IMHO, easier to deal with.  I'd like for this to work either way and I see no reason why i...

Code behind unable to detect web control object
Hi there,  Given the following aspx script, I was not able to detect MyFirstControl1 in the code behind file although I can do so for MyFirstControl2. Why is that?<%@ Register Src="MyFirstControl.ascx" TagName="MyFirstControl" TagPrefix="uc1" %> <%@ Register Src="MySecondControl.ascx" TagName="MySecondControl" TagPrefix="uc2" %> ... ... <asp:MultiView ID="MultiView1" runat="server">    <asp:View ID="View1" runat="server" EnableTheming="True...

Web.config AND Custom Web Controls
Hi, I've got defined a key with a value in web.config file and I want to read this value from a web control CS file (ConfigurationSettings.AppSettings["key"]). When the app is running, everything seems to be right, but the value is empty. Is it possible to access web.config values from web control files? Martin...

Web Custom Control
Is there a way for a web custom control to retrieve property value from its parent's web applications global.asax file at design time? This would enable the user of the control to capture defaults in the global.asax file. The control should only retrieve the values from the global.asax file when it is first placed (dragged) onto the form from the toolbar. After that it should only use the properties specified by the user. Let me know if you have any ideas, Mike - Cache entire web sites at the client and server and keep cache current. Cache just got easier! Blogged http://web...

Custom Web Control inside another Custom Web Control
Hi I created a custom web control (CusWebNew) that displays some textboxes by adding them to the ControlCollection of the webcontrol. I also created a custom webcontrol (CustWebButton) that inherts from Button control, and overrided the OnClick function. When I use CustWebButton on a regular web form, it seems to function correctly. However, when I added to be part of the ControlCollection of CustWebNew, it stops to work.   Any ideas why? Thanks Hey, What do you mean by stops to work?  Explain what you are trying to do with it and what it doesn't do.Brian"Trust in the...

Call code-behind method in Web Custom Control inside UpdatePanel
 Hello!So this is the scenario... I need to display a list of elements with certain properties, for that I've created a Web Custom Control that has the interface of a table row with several custom properties. One of the columns is a Checkbox. I want to call a code-behind method (written in the Custom Control class) on the OnCheckedChanged event.The problem: I have a big list of elements (around 100) and I can't find a way to register all the controls to call the method because I guess I would need an AsyncPostbackTrigger...  Or in a simple way: how can I call a method progr...

Add .Net Control to Web Custom Control
 I want to add .NET Control (like: TextBox, Button...) to Web Custom Control.How i can do it? Alphavn That's called a composite control -- "Mark As Answer" if my reply helped you -- Hello Guys What gunteman said, that is one approach and in most cases the right one.But its also possible to add child controls to a Control thats inherit from WebControl itself. Be sure to implement INamingContainer to that inherited Control too, thats the important point of that approach.--Microsoft MVP - Visual Developer ASP / ASP.NET- http://www.aspnetzone.de/blogs/peterbuch...

Encapsulating javascript menu code into a custom Web Control in .NET 3.5/VS 2008
I am using the "Droppy" javascript hierarchical drop down menu code from jquery projects and I want to either duplicate the functionality and look/feel in new code or encapsulate the Droppy code into a .NET 3.5 custom Web Control. Has anyone had experience doing this (encapsulating existing JavaScript code into a custom Web Control) or does anyone know of a solution that is .NET only?   Thanks in advance Hi,yes you can embed your javascript as a webresource. Take a look at this article: Creating Custom ASP.NET Server Controls with Embedded JavaScript Gr...

controlling an object in a web control from the page the web control is placed in
I have created a web control in vb.net that has an image button and an image. when it loads the image button is visible and the image is not. I want to be able from the page which "includes" the web control to set the image button to invisible and the image to visible. When I tried this, the main page didn't recognise the image button or the image (both < asp: objects). help would be gratefully appreciated. oh yeah, it's inline code so any code behind stuff will just confuse me ;) Some code please.-- Justin Lovell...

How do I set the value of a custom property of a custom control in code-behind?
Perhaps I'm going about this the wrong way entirely, and I'm actually asking the wrong question... so here's what I would like to do: I have CustomControlB embedded in CustomControlA... CustomControlB has a custom property of "PublisherID" which I have created like this: private string _publisherid;public string PublisherID{     get     {          return _publisherid;     }     set     {     &nbs...

Problem trying to import global.asax code from code behind
Hi guys, I have been trying to import the contents of my global.asax file from my compiled code behind dll (The reason I am doing this is because I want to call a shared sub routine that is part of the dll), but when I try to run any of the pages on my site I get the following error: 'Gulf.Global' is not a valid base class because it does not extend class 'System.Web.HttpApplication'. My Global.asax file looks like this: <%@ Application Inherits="Gulf.Global"%> ANd my code behind looks like this: PUBLIC CLASS Global Inherits System.Web.UI.P...

Web resources about - global.asax, object tag and custom web control behind code - asp.net.config-deploy

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 ...

Run-fests no more as bowlers take control in Adelaide
The extent to which batsmen struggled in Adelaide would have exceeded even the most pessimistic of forecasts.

‘Enough Is Enough’: Obama Demands More Gun Control After Colorado Shooting
President Obama again turned to gun control as a potential solution to the horrific act

Obama pushes for gun control after Colorado shooting
"This is not normal," president says after gunman fatally shoots three people, including police officer, at Planned Parenthood facility

Boldin: Gabbert 'heck of a quarterback, he's poised, under control'
Skip to main content CSN Bay Area Header links TV Listings Contact App Email Follow Bar RSN login or register Login Search form Search 43° Navigation ...

Democrats New Plan For Gun Control – A Secret Government Terrorist Watch List
They call it the "Denying Firearms and Explosives to Dangerous Terrorists Act of 2015"

The Legend of Zelda: Twilight Princess Wii U will likely support Wiimote and Nunchuk controls
Well this is interesting. Fans have been speculating as to the control schemes that will be supported in The Legend of Zelda: Twilight Princess ...

The UN Can't Solve Climate Change, But CO2 Controls Are Coming Anyway
Diplomats, activists and politicians from virtually every country in the world are gathering in Paris for the 21st annual UN climate conference. ...

Indonesia says pilot response to faulty rudder control caused AirAsia crash
Indonesia says pilot response to faulty rudder control caused AirAsia crash

Easy Power Supply Mod Takes Control
... supplies are great for the home hobbyist, featuring wide voltage range and current limiting for a low price. What’s not to love? The controls; ...

Resources last updated: 12/1/2015 4:37:50 PM