views:

344

answers:

3

Hi!

Sorry my very poor english ...

I'm using asp.net control toolkit to do a calendar on asp.net mvc, and it works fine! But it is in english format date. How can i change to pt-BR culture? I read lot of sites, but i couldn't implement on my project.

Anyone could put a link to show me a valid implementation about culture?

And why putting: <globalization culture="pt-BR" uiCulture="pt"/> in webconfig file between system.web tags doesn't work?

Thanks

A: 

Hello Juliana,

Easy option would be to change you browsers language; as it should then pick up this as the native culture to use (in internet explorer this is: tools > internet options > below appearance there is language)

Alternatively look at doing:

var culture = new System.Globalization.CultureInfo("pt-BR");
System.Threading.Thread.CurrentThread.CurrentUICulture = culture

To force your application to return in this culture.

Luke Duddridge
found a page on the msdn, but I am guessing you already may have seen it?http://msdn.microsoft.com/en-us/library/bz9tc508.aspx
Luke Duddridge
+1  A: 

Where i have to put this code? Inside which method?

Thanks for answering, Luke

I put inside default.aspx page_load, but the names of the month in my calendar didn't change:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ' Change the current path so that the Routing handler can correctly interpret ' the request, then restore the original path so that the OutputCache module ' can correctly process the response (if caching is enabled).

Dim originalPath As String = Request.Path
HttpContext.Current.RewritePath(Request.ApplicationPath, False)
Dim httpHandler As IHttpHandler = New MvcHttpHandler()
httpHandler.ProcessRequest(HttpContext.Current)
HttpContext.Current.RewritePath(originalPath, False)

    Dim culture As New System.Globalization.CultureInfo("pt-BR")
    System.Threading.Thread.CurrentThread.CurrentUICulture = culture

End Sub

Juliana Machado
put it in global.asax.cs inside of void Application_BeginRequest(object sender, EventArgs e)I upvoted your post. Hopefully you can now add comments to posts.
Malcolm Frexner
A: 

I put this code in global.asax:

Dim culture As New System.Globalization.CultureInfo("pt-BR") System.Threading.Thread.CurrentThread.CurrentUICulture = culture

inside: Application_BeginRequest, Application_Start and Sub New ... and still doesn't work!!

Juliana Machado