Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Localize one control only

Reply
Thread Tools

Localize one control only

 
 
MattB
Guest
Posts: n/a
 
      05-09-2005
I need to make the stock asp calendar control appear in a different
language. Can this be done by changing properties of the calendar
control programmatically? I want to keep the rest of the application as
it is if possible. It needs to be in French. Thanks!

Matt
 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      05-10-2005
Matt, I enjoyed finding the solution to that question. The best way I could
think of was to use a custom control, ala:

ublic class LocalizedCalendar : Calendar
{
private string culture;

public string Culture
{
get { return culture; }
set { culture = value; }
}

protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
CultureInfo originalCulture =
System.Threading.Thread.CurrentThread.CurrentCultu re;
if (culture != null && culture.Length > 0)
{
try
{
System.Threading.Thread.CurrentThread.CurrentCultu re = new
CultureInfo(culture);
}
catch (ArgumentException ex){}

}
base.Render (writer);
System.Threading.Thread.CurrentThread.CurrentCultu re = originalCulture;
}
}
}

Cheers,
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)


"MattB" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I need to make the stock asp calendar control appear in a different
>language. Can this be done by changing properties of the calendar control
>programmatically? I want to keep the rest of the application as it is if
>possible. It needs to be in French. Thanks!
>
> Matt



 
Reply With Quote
 
 
 
 
MattB
Guest
Posts: n/a
 
      05-10-2005
Karl Seguin wrote:
> Matt, I enjoyed finding the solution to that question. The best way I could
> think of was to use a custom control, ala:
>
> ublic class LocalizedCalendar : Calendar
> {
> private string culture;
>
> public string Culture
> {
> get { return culture; }
> set { culture = value; }
> }
>
> protected override void Render(System.Web.UI.HtmlTextWriter writer)
> {
> CultureInfo originalCulture =
> System.Threading.Thread.CurrentThread.CurrentCultu re;
> if (culture != null && culture.Length > 0)
> {
> try
> {
> System.Threading.Thread.CurrentThread.CurrentCultu re = new
> CultureInfo(culture);
> }
> catch (ArgumentException ex){}
>
> }
> base.Render (writer);
> System.Threading.Thread.CurrentThread.CurrentCultu re = originalCulture;
> }
> }
> }
>
> Cheers,
> Karl
>


Wow. Thanks Carl! I'll start moving this to vb and give it a shot right
away!

Matt
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's the Difference between an asp:Literal control and an asp:Localize control? netcodedevil@gmail.com ASP .Net Web Controls 0 09-26-2007 11:12 AM
how to localize a web application which makes use of custom control??? Arti ASP .Net 0 07-26-2007 10:25 AM
Localize control Vs Literal Goofy ASP .Net 0 12-14-2006 01:01 PM
how to localize a composite control Julia ASP .Net Web Controls 1 06-26-2006 09:06 AM
Localize control Johndoe ASP .Net Web Controls 1 01-01-2006 06:37 PM



Advertisments