Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problems updating a date column in using GridView
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01236618
Message ID:
01236650
Vues:
17
Govinda,

>I've run into a problem with updating a gridview DATE column to null. I enabled editing on the gridview using the method explained in the "How to Add Paging to a GridView" article in the MM.Net developer guide. But I get "String was not recognized as a valid DateTime.Couldn't store <> in survey_date Column. Expected type is DateTime." exception when attempting to save the dataset and the date column is empty. I understand there issues when binding a textbox to a date database column, but this works on other pages where I'm binding to a mmtextbox in a standard web form.

Sorry it took an extra day to get back to you on your other questions--we got a little behind this week!

When binding a GridView column to a DateTime value you need to set the column's DateFormatString property to {0:d} and set the HtmlEncode property to False so that the DataFormatString is properly applied.

For details, check out the MM .NET Dev Guide "Jump Start: Web Forms Application - Step 10 - Enhancing the Orders GridView"

Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform