Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8891877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:51:03+00:00 2026-06-14T22:51:03+00:00

I am developping a small training ASP .Net web application. I have developped an

  • 0

I am developping a small training ASP .Net web application.
I have developped an ASPX page where I have declared a FormView control linked to an ObjectDataSource through data binding.
The update method takes a Product object.
A Product object has a property Price containing a double value.

The user can Create Read Update Delete products through the FormView.
But an error can be raised when updating or inserting a product.

More precisely the error is raised when a Product object is instantiated from input values of the FormView.
The string contained in the input control associed with the Price property could not be cast to a double.
As an example “50,6” can not be cast to a double.
The coma is the decimal separator.
I guess ASP .Net expects a point for the decimal separator because it probably considers the EN-US culture.

Here is the stack trace I get in the browser :

System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) +489
System.Web.UI.WebControls.ObjectDataSourceView.ConvertType(Object value, Type type, String paramName) +117
System.Web.UI.WebControls.ObjectDataSourceView.BuildObjectValue(Object value, Type destinationType, String paramName) +167
System.Web.UI.WebControls.ObjectDataSourceView.BuildDataObject(Type dataObjectType, IDictionary inputParameters) +229
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +1421
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +95
System.Web.UI.WebControls.FormView.HandleUpdate(String commandArg, Boolean causesValidation) +1154
System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +445
System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source, EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source, EventArgs e) +112
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +125
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +169
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +9
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

Is it possible to specify a culture to consider when setting object properties from string values through data binding ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:51:05+00:00Added an answer on June 14, 2026 at 10:51 pm

    For .Net 4.5 and above this may work:

    Page_Init(object sender, EventArgs e)
    {
        MyObjectDataSource.ParsingCulture = ParsingCulture.Current;
                                                     //Invariant is en-US
    }
    

    Also, make sure the test client’s culture is set to “FR-FR” for both browser and OS. The MSDN explains that the client’s culture may be used instead of the server’s culture for parsing. (They don’t discuss invariant culture but you definitely don’t want it.)

    If this doesn’t work, or you’re on .NET 4.0 or earlier using InsertParameters may help (regardless of whether you’re using POCOs or parameters):

    see this thread: http://forums.asp.net/t/963913.aspx/1

    <asp:ObjectDataSource ...>
       ...
       <InsertParameters>
          <asp:Parameter Name="Birthdate" Type="DateTime" />
          <asp:Parameter Name="AnnualIncome" Type="Decimal" />
          <asp:Parameter Name="Height" Type="Double" />
       </InsertParameters>
    </asp:ObjectDataSource ...>
    

    EDIT: There’s a related stack overflow question on this: ObjectDataSource fails to parse string to DateTime

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developping a card game. I have an ASP.NET page with some 52 small
I am developping an intranet ASP.NET MVC2 application for a small business. The small
I am developping a (relatively small) website in ASP.Net 2.0. I am also using
I'm faced with a problem with a small web application I'm developping: My HTML-source
I'm developing a small application using Blend, basically what I have in my application
I'm developing a small web framework using Guice. I have a Router object that,
I have question I'm developing small application to desktop in win Forms. I'm using
I'm developing a small web application using Microsoft Silverlight 3. I'm using Microsoft Expressin
Good day! I'm developping a small Java Application with NetBeans IDE that extends JFrame.
I'm developing a small application in Ruby-On-Rails. In a controller I have this piece

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.