Wednesday, January 16, 2019

how to use the resource file from other page in ASP.Net web application

we can localize the web application with the resource file from Visual studio. Visual studio automaticaly generate the resource file under this folder.

c:\projectfolder\App_LocalResources

in the page level we can use the key in the resource to reference the content.

<asp:Literal runat="server" Text="<%$ Resources:MyKey %>" />

if we want to use this content in other pages.

we can simply follow the steps below

1. add the reference to the resource namespace, you can find the namespace from the design.cs file.

<%@ Import Namespace="Resources.UserControls" %>



2. add the following line to your page which have a reference to the resource file and key.

<%=MyOtherPage_ascx.MyOtherKey %> 






No comments:

Post a Comment