O'Reilly logo

Professional ASP.NET 3.5 AJAX by Matt Gibbs, Dan Wahlin, Bill Evjen, Dave Reed

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

13.5. ASP.NET 3.5 Resource Files

When you work with ASP.NET 3.5, all resources are handled by a resource file. A resource file is an XML-based file that has a .resx extension. You can have Visual Studio 2008 help you construct this file. Resource files provide a set of items that are utilized by a specified culture. In your ASP.NET 3.5 applications, you store resource files as either local or global resources. The following sections look at how to use each type of resource.

13.5.1. Making Use of Local Resources

You would be surprised how easily you can build an ASP.NET page so that it can be localized into other languages. Really, the only thing you need to do is build the ASP.NET page as you normally would and then use some built-in capabilities from Visual Studio 2008 to convert the page to a format that allows you to plug in other languages easily.

To see this in action, build a simple ASP.NET page as presented in Listing 13-10.

Example 13-10. Building the basic ASP.NET page to localize
<%@ Page Language="C#" %>

<script runat="server">

    protected void Button1_Click(object sender, EventArgs e)
    {
Label2.Text = TextBox1.Text; } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Sample Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="Label1" runat="server" Text="What is your name?"></asp:Label><br /> <br /> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>&nbsp; <asp:Button ID="Button1" runat="server" Text="Submit ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required