<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Control.ascx.cs" Inherits="ChooseCultureControl" %>
CssClass="cultureFlag" BorderWidth="1"
CommandName="US"
OnCommand="imgCommand"
ImageUrl="images/flag_us.gif"
meta:resourcekey="imgUSResource1" />
CssClass="cultureFlag" BorderWidth="1"
CommandName="France"
OnCommand="imgCommand"
ImageUrl="images/flag_fr.gif"
meta:resourcekey="imgFRResource1" />
File: Control.ascx.cs
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class ChooseCultureControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (Profile.Culture == "fr-FR")
{
imgFR.BorderStyle = BorderStyle.Dotted;
imgUS.BorderStyle = BorderStyle.None;
}
else
{
imgUS.BorderStyle = BorderStyle.Dotted;
imgFR.BorderStyle = BorderStyle.None;
}
}
protected void imgCommand(object sender, CommandEventArgs e)
{
if (e.CommandName == "France")
Profile.Culture = "fr-FR";
else
Profile.Culture = "en-US";
Response.Redirect(Request.Url.AbsolutePath);
}
}
File: Web.config