How to add resources during runtime

Answer Posted / mithun

Call the GetLocalResourceObject or GetGlobalResourceObject method to read specific resources from a global or local resource file

The GetGlobalResourceObject method takes the name of a resource class and the resource ID. The class name is based on the .resx file name. For example, the file WebResources.resx, and all associated localized files, are referenced by the class name WebResources.

The GetLocalResourceObject method takes a resource name representing a ResourceKey property.

Button1.Text = GetLocalResourceObject("Button1.Text").ToString();

Button2.Text = (String)GetGlobalResourceObject(
"WebResourcesGlobal", "Button2.Text");


A local default resource file stored in the special App_LocalResources folder is named according to the ASP.NET page. For example, if the following code is used in a Default.aspx page, the resource file must be named Default.aspx.resx. For this example, add a string resource to this file named Button1.Text with the value "Found Resources".

A global default resource file that is stored in the special App_GlobalResources folder is named WebResourcesGlobal.resx. Add a string resource named LogoUrl with the value "Found Resources".

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where to use new keyword other than create instance?

666


how barcode print on the win form

2014


What is the use of form?

529


Name the event that enables the user to prevent shifting of focus from control until all the validation rules have been met.

527


What are the advantages of form?

521






How to use the FindControl() function to preselect an item in my dropdownlist?

1705


How can you pause a timer control?

639


Name the two main categories of .net components.

536


What are windows based applications examples?

544


Which template creates a .net compact framework 2.0 forms application for pocket pc 2003 and later?

565


Explain how barcode create in the report?

573


What is a windows based application?

539


Explain how many number of events does the timer controls?

527


How do you apply specific formatting to the data inside the cells?

1836


What is the synonym of form?

516