Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 4th, 2013, 01:33 PM
Authorized User
 
Join Date: Feb 2013
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
Default Error deleting a Gridview record that has a formatted column

I have a GridView bound to a DataSource in which one of the BoundFields has a DataStringFormat of {"0:C0"}. When I delete a record I get an error indicating that the field cannot be converted to a Decimal type. If I remove the format, the delete works fine.

Is the GridView/DataSource combination not intelligent enough to automatically strip off formatting prior to a database operation?
 
Old March 4th, 2013, 01:49 PM
Authorized User
 
Join Date: Feb 2013
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
Default A little knowledge is a dangerous thing

An answer to my own question:

A BoundField has the property HtmlEncodeFormatString set to "True" by default. This interferes with the interaction with the DataSource. Set the property to "False" and the Delete (and presumably Insert & Update) work fine.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
Problems deleting a record donrafeal Access VBA 0 January 18th, 2007 06:19 PM
Problems In Deleting Record nkrust ASP.NET 1.0 and 1.1 Professional 2 January 12th, 2007 11:52 PM
Invalid Column Name error when saving record mmcdonal SQL Server 2000 2 September 5th, 2006 12:42 PM
Deleting A Record sirmilt BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 July 31st, 2006 07:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.