GridView-Update-Exception, Parse Error when german culture

  • Thread starter Thread starter Rolf Welskes
  • Start date Start date
R

Rolf Welskes

Hello,
If I have a simple GridView which has in its data a decimal -type and the
page is German Culture the following happens:

I edit a row, click update-button in GridView, exception.
The exception is that the decimal ist for example 12, 15 instead 12.15

If I set to en-culture and have default point as separator and so do not use
for example 12,15 but only 12.15 all works fine.

Seems, that the Parse function when updating does not recognize the correct
NumberFormatInfo from the setted Culture.

Any help would be fine.

Thank you.
Rolf Welskes
 
Hi Rolf,

I was able to reproduce this issue.

I also found some related bug report regarding ObjectDataSource:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedbac
kID=105016

I'm currently confirming whether or not this is also an issue of
SqlDataSource and will get back to you as soon as possible. Thank you for
your patience and understanding.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Rolf,

I'm afraid you'll have to use some workaround to deal with this issue for
now. You can handle GridView's RowUpdating event and convert the decimal
values back to string format using InvariantCulture:

protected void GridView1_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{
for (int i = 0; i < e.NewValues.Count; i++) {
object obj = e.NewValues;
if (obj is string) {
double objValue;
if (double.TryParse(obj as string, out objValue)) {
e.NewValues =
objValue.ToString(CultureInfo.InvariantCulture);
}
}
}
}

Sorry for the inconvenience of this issue. Please feel free to submit your
feedback at
http://connect.microsoft.com/Main/content/content.aspx?ContentID=2220.
Thanks for your understanding.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hello,
thank you for your answer.
It helps in the moment.
I hope this will be realy solved in the next version, because cultureInfo
relevant formatting is fundamental for
the gridview on internet pages.

Thank You again.
Rolf Welskes
 
Hi Rolf,

Thank you very much for your understanding. I have already reported this
issue to our product team; hopefully this will be addressed in next version.

Have a nice day!

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top