Ask a Question related to ASP.NET Building Controls, Design and Development.
-
Samuel #1
How to "Imports Resources" into compiled custom controls?
Hi,
I am building a custom control for a Web Application in ASP.NET 2.0 that
makes use of the name space "Resources" for localization
(app_globalresources) by adding this to the top of the customcontrol.vb file
in the app_code directory:
Imports Resources
However, when I move the file to a project of its own, the reference to
Resources cannot work anymore for understandable reasons since resources is
not part of the project. How do I make use of the global resource of the web
application for the custom control?
Do I have to create a resource for the custom control? I want to keep
localization in one place though.
Do I have to leave the custom control in App_Code if I want localization to
be in one place?
Please let me know if it is possible.
Samuel Guest
-
Acrobat Pro does not open because : "language resources"
Suddenly (I think after an update about a month ago) Acrobat Pro 6.0.2 refuses to open. I get this message : «The currently selected language... -
changes to .as files not "compiled"
Upon making modifications to .as files, I've noticed when testing movies within the IDE (ctrl-ENTER) that my changes are not always applied. I use... -
Impatient Newbie Question: "Self-Compiled..."???
"dhtapp" <dhtapp@cox.net> wrote: If you're referring to:- http://www.ruby-talk.org/78848 -----------------------------------------------------... -
"required resources" problem
I only get this error when attempting to work with picture packages. It was discussed on a different thread and I thought we had it resolved, but it... -
"sendmail_from" not set in php.ini or custom "From:" header missing
Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 14 Message-ID:... -
Steven Cheng[MSFT] #2
RE: How to "Imports Resources" into compiled custom controls?
Thank you for posting .
From your description, you're developing some custom ASP.NET web control,
and the webcontrol will use some resources in the ASP.NET application's
Global or Local Resource collection to perform some localization work.
Howerver, you found it works well when put in the ASP.NET app's App_Code
dir, when moved to a separate class library project, it stoped working,
correct?
Based on my understanding, as for the Global/Local Resources in ASP.NET
application, they can be retrieved through declarative syntax or
programmatic syntax. I think you are using the programmatic approach (the
GetGlobalResourceObject and GetLocalResourceObject method). If this is
the case, in your custom classlibrary project, if your custom control still
want to utilize these methods, you need to reference System.Web.dll
assembly, and then, use the HttpContext's static methods to reference the
two methods, e.g.
protected override void RenderContents(HtmlTextWriter output)
{
string value =HttpContext.GetGlobalResourceObject("strings",
"key1").ToString();
output.Write("<br/>Key1: " + value);
output.Write(Text);
}
The following msdn document has also mentioned the HttpContext class for
the two methods:
[url]http://msdn2.microsoft.com/en-us/library/ms227982(VS.80).aspx[/url]
Hope this helps.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! [url]www.microsoft.com/security[/url]
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Steven Cheng[MSFT] Guest



Reply With Quote

