Thursday, 22 March 2012

Problem: Can change Global Resource in ASP.NET?

Impact: When you change languages in Tools-> Options isn't working?

Solution: First of all you have to create App_Global Resource for defining your key after that you have to add Culture="auto" UICulture="auto" in directive control.

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="GlobalResourceExample.aspx.cs"
 Inherits="_Default" Culture="auto" UICulture="auto" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">

<asp:Label ID="lblFirstName" runat="server" Text="<%$ Resources: myResource, LabelFirstName%>" /><br />

<asp:TextBox ID="txtFirstName" runat="server" />
<br />
<asp:Button ID="btn" runat="server" Text="<%$ Resources: myResource, LabelFirstName%>" onClick="subSubmit" />
<br />
<asp:Label ID="lblOut" runat="server" />

</asp:Content>


No comments:

Post a Comment