473,513 Members | 2,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access Page's local resource from user control

Is it possible to get access to the local resource
(App_LocalResources) of an aspx page from within a user control
located somewhere else? I have created a user control which I want to
add to a page and read values from the page's local resource. But
within the code of the user control, I can only access the local
resource of the user control itself in its own App_LocalResources
folder.
Can someone help me please?

Cheers, Hannes

Apr 16 '07 #1
1 3611
sc*******@rehm.de schrieb:
Is it possible to get access to the local resource
(App_LocalResources) of an aspx page from within a user control
located somewhere else? I have created a user control which I want to
add to a page and read values from the page's local resource. But
within the code of the user control, I can only access the local
resource of the user control itself in its own App_LocalResources
folder.
Can someone help me please?

Cheers, Hannes

I found a satisfactory solution myself: The magic word is "delegate".
For those who are interested, here's some sample code. It is very easy
to implement.

In the content page's master page respectively the user control it
contains you put the delegate declaration:

public delegate object GetPageLocalResourceObject(string
resourceKey); // the delegate declaration itself
public GetPageLocalResourceObject LoadLocalPageResource; // public
instance of the delegate to be set by the content page

Now in every content page, you have to put one or both of the
following lines into its Page_Load function (depending on whether you
use a master page or a user control or both):

<Instance of the User Control>.LoadLocalPageResource =
GetLocalResourceObject; // set the user control's delegate instance to
my own GetLocalResourceObject function
Master.LoadLocalPageResource = GetLocalResourceObject; // set the
master page's delegate instance to my own GetLocalResourceObject
function

HTH!

Apr 17 '07 #2

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

Similar topics

3
2391
by: vincentw56 | last post by:
This is the first time I have tried this. What we have is a com object the generates keys. A developer here wrote a .Net wrapper in C# for this com object. I am trying to call her dll wrapper...
1
1563
by: Jeremy | last post by:
Hi, I hope (expect!) this is straightforward - at this stage I need to know the feasibility of this. The scenario: a webserver running a database. A subset of the data (say 3 tables) needs to be...
3
3481
by: Lyle Fairfield | last post by:
In a recent thread there has been discussion about Data Access Pages. It has been suggested that they are not permitted on many or most secure sites. Perhaps, that it is so, although I know of no...
0
1485
by: Goran | last post by:
Hi I have created a very simple ASP.Net application that only consists of a CrystalReports Viewer, that has been connected to a .rpt file. When the page is loaded in the browser, the following...
2
18912
by: Brent Burkart | last post by:
I am trying to send an email using SMTP server through IIS. I am recieving the following error. Access is denied. Description: An unhandled exception occurred during the execution of the...
2
3006
by: paul meaney | last post by:
All, myself and another developer have been staring blankly at a screen for the past 48 hours and are wondering just what stunningly obvious thing we are missing. We are trying to load up 2...
5
3089
by: Dave Kolb | last post by:
Is there any other solution for an ASPNET application to access network resources other than running as SYSTEM, using delegation (a nightmare to get to work) or the COM+ solution? I cannot seem to...
4
2812
by: Scott Shuster | last post by:
Hi, I've been searching and testing and have not yet found the answer I'm looking for. I have an ASP.NET (vb) application with an ecommerce function. When the user submits the page, I DON'T...
1
8944
by: cpajoe2001 | last post by:
I am having an issue and after searching around online for a day and half now and finding others with the same problem but yet no solution to my issue I am looking for help. What i have is ServerA...
0
7158
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
7535
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...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.