Thursday 27 December 2012

Set and Get values in string resource file


Creating Resources From a Web Page

The following feature is not available with Visual Web Developer Express.

To generate a local resource file from an ASP.NET Web page

  1. Open the page for which you want to create a resource file.
  2. Switch to Design View.
  3. In the Tools menu, click Generate Local Resource.
    Visual Web Developer creates the App_LocalResources folder if it does not already exist. Visual Web Developer then creates the culturally neutral base resource file for the current page, which includes a key/name pair for each control property or page property that requires localization. Finally, Visual Web Developer adds a meta attribute to each ASP.NET Web server control to configure the control to use implicit localization. For more information about implicit and explicit localization, see ASP.NET Web Page Resources Overview and How to: Use Resources to Set Property Values in Web Server Controls.
    Note:
    {Do not attempt to embed a graphic directly in a resource file because controls will not read the resource string as a streamed image file. Resource files represent graphics by storing the URL of the graphic as a string.}
  4. If the latest resource changes are not displayed, refresh Design view by switching to Source view and then switching back to Design view.
  5. Create resource files for additional languages by following steps 6 and 7 in the preceding procedure

    Add Values  to resource file
    Open with xml(text)Edit
    then
    <data name="PasswordError" xml:space="preserve">
        <value>Password or user name is invalid</value>
      </data>

    Call Resource file value in code-behind
     Strings.PasswordError

    MVC Razor side
     @Strings.PasswordError 

No comments:

Post a Comment

If any doubt?then please comment in my post

How to reduce angular CLI build time

 Index: ----- I am using angular cli - 7 and I am going to tell how to reduce the build time as per my knowledge. Problem: -------- Now the ...