tags:

views:

142

answers:

2

My form contains a textbox for date input. When submitted the data is used to add a row to the table. The view is strongly typed to the table.

The problem is that the database server is configured with US date format. But the users need to use UK date format in the textbox. When users enter uk date format error is thrown.

The database server configuration cannot be changed. So what can be done so that users can enter date in uk format?

+2  A: 

Try setting the culture in web.config:

<system.web>
    <globalization 
        requestEncoding="utf-8" 
        responseEncoding="utf-8" 
        culture="en-GB" 
        uiCulture="en-GB"/>
</system.web>
Darin Dimitrov
A: 

This is where a view model class would come in handy. The idea is that you would create another class that would make the job of the view easier. So in this case you would expose that date as a string (a correctly formatted one) for the view. View models are pretty easy to create and maintain by using AutoMapper.

Sayed Ibrahim Hashimi
i am using a view model. The view is linked to viewmodel.the view model contains the class in which this date field exist.