我使用EntityDataSource
,我在格式化日期后得到错误转换
DataFormatString="{0:dd/MM/yyyy}"
[EntityDataSourceValidationException: Error while setting property 'fromDate': 'Cannot convert the value of parameter 'fromDate' to the type 'System.DateTime'.'.]
Microsoft.AspNet.EntityDataSource.EntityDataSourceView.ConvertProperties(IDictionary values, PropertyDescriptorCollection propertyDescriptors, ParameterCollection referenceParameters, Dictionary`2 convertedValues) +737
Microsoft.AspNet.EntityDataSource.EntityDataSourceView.ExecuteDelete(IDictionary keys, IDictionary oldValues) +383
System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary oldValues, DataSourceViewOperationCallback callback) +84
Telerik.Web.UI.GridTableView.PerformDelete(GridEditableItem editedItem, Boolean suppressRebind) +228
Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source) +2417
Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +91
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
我的aspx:
<telerik:GridDateTimeColumn HeaderText="تاريخ البداية" UniqueName="fromDate" SortExpression="fromDate" DataField="fromDate" DataFormatString="{0:dd/MM/yyyy}"></telerik:GridDateTimeColumn>
注意:sqlserver db中的
fromDate
类型为Date
答案 0 :(得分:1)
试试:
<telerik:GridBoundColumn DataField="fromDate" DataType="System.DateTime" HeaderText="تاريخ البداية"
UniqueName="fromDate" DataFormatString="{0:dd/MM/yyyy}" HtmlEncode="false"/>