Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > calendar control in different languages?

Reply
Thread Tools

calendar control in different languages?

 
 
nacho
Guest
Posts: n/a
 
      09-12-2003
It it possible to display the calendar control in
different languages according to the navigator culture?
If so, how (any www reference will be very appreciated)

Thanks.
 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      09-16-2003
The code below tries to sniff the language. It also fills a dropdownlist with
the available languages on the system to investigate. You can see how talented
the calendar control is at languages.

Does this help?

Ken
MVP [ASP.NET]


Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim userLang() As String
Dim strName As String
userLang = Request.UserLanguages

If Not IsPostBack Then
Session("strLanguage") = userLang(userLang.GetUpperBound(0))
If Session("strLanguage") = "" Then
Session("strLanguage") = "en-US"
End If
Dim ci As CultureInfo
For Each ci In _
CultureInfo.GetCultures(CultureTypes.AllCultures)
If Not ci.IsNeutralCulture Then
ddlCultures.Items.Add(ci.ToString)
End If
Next ci
Dim dtNow As Date = DateTime.Now
strName = Session("strLanguage")
Thread.CurrentThread.CurrentUICulture = _
New CultureInfo(strName, False)
Thread.CurrentThread.CurrentCulture = _
New CultureInfo(strName)
Calendar1.SelectedDate = dtNow
Calendar1.VisibleDate = dtNow
End If
End Sub
Private Sub Calendar1_SelectionChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Calendar1.SelectionChanged
Dim strName As String = Session("strLanguage")
Thread.CurrentThread.CurrentUICulture = _
New CultureInfo(strName, False)
Thread.CurrentThread.CurrentCulture = _
New CultureInfo(strName)
End Sub

Private Sub btnTry_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles btnTry.Click
Dim strName As String
strName = ddlCultures.SelectedItem.Text
Session("strLanguage") = strName
Thread.CurrentThread.CurrentUICulture = _
New CultureInfo(strName, False)
Thread.CurrentThread.CurrentCulture = _
New CultureInfo(strName)
End Sub



<%@ Page Language="vb" AutoEventWireup="false" Codebehind="callocal.aspx.vb"
Inherits="p733workev.callocal"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>callocal</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body ms_positioning="FlowLayout">
<form id="Form1" method="post" runat="server">
<p>
<asp:dropdownlist id="ddlCultures"
runat="server"></asp:dropdownlist></p>
<p>
<asp:button id="btnTry" runat="server" text="Try It!"></asp:button></p>
<asp:calendar id="Calendar1" runat="server"></asp:calendar>
<p>&nbsp;</p>
<p>&nbsp;</p>
</form>
</body>
</html>


--

Important: Patch Windows *beyond* Blaster.
http://www.microsoft.com/technet/sec...n/MS03-039.asp


"nacho" <(E-Mail Removed)> wrote in message
news:030601c3790e$3d9c91c0$(E-Mail Removed)...
It it possible to display the calendar control in
different languages according to the navigator culture?
If so, how (any www reference will be very appreciated)

Thanks.


 
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
How to show holidays in a different color in calendar web server control? Simon ASP .Net 4 06-20-2008 06:31 AM
How to Synchronise Hotmail Calendar with Standard Outlook Calendar using Outlook Connector ?? Synapse Syndrome Computer Support 0 12-02-2007 04:19 AM
Thunderbird Calendar with Exchange 2003 Calendar and Public FoldersCalendar jincmcse Firefox 1 09-03-2005 02:46 AM
Calendar Control - Programatically set the calendar to a date range Shevek ASP .Net 3 06-23-2004 01:41 PM
Calendar Control - Programatically set the calendar to a date range Shevek ASP .Net Web Controls 0 06-23-2004 12:06 PM



Advertisments