ASP.NET MVC2 : DateTime modelbinding via HTTP GET
        Posted  
        
            by 
                mathieu
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by mathieu
        
        
        
        Published on 2010-09-03T09:47:33Z
        Indexed on 
            2011/01/03
            18:53 UTC
        
        
        Read the original article
        Hit count: 225
        
I'm getting some trouble binding a date from QueryString :
I have the following model
public class QueryParms
{
    public DateTime Date { get; set; }
}
And the following controller action :
public ActionResult Search( QueryParms query );
I have a form, with a field where I can type my date. If the form is FormMethod.Post, everything is fine, my date is correctly bound to my model.
If the form is FormMethod.Get, it is not working anymore. The date is left to the default value (01/01/0001)
I think it is a culture issue : When i look into the value provider, the FormValueProvider has a culture property set for my date : {fr-FR}. The QueryStringValueProvider doesn't have the culture property set.
Is there a way to set this property ?
© Stack Overflow or respective owner