This is a migrated thread and some comments may be shown as answers.

Entity Datasource AllowAutomaticDeletes=true -> Cannot delete "not a valid value for Decimal"

8 Answers 213 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rich
Top achievements
Rank 1
Rich asked on 08 May 2009, 01:40 PM
Hi Allow,

I am using an entity datasource on a grid and allowing auto inserts, updates and deletes. Everything seems to be working fine accept while trying to delete i am getting the following:

Error while setting property 'freightRate': '$222.00 is not a valid value for Decimal.'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.UI.WebControls.EntityDataSourceValidationException: Error while setting property 'freightRate': '$222.00 is not a valid value for Decimal.'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[EntityDataSourceValidationException: Error while setting property 'freightRate': '$222.00 is not a valid value for Decimal.'.]
   System.Web.UI.WebControls.EntityDataSourceView.ConvertProperties(IDictionary values, PropertyDescriptorCollection propertyDescriptors, ParameterCollection referenceParameters) +71835
   System.Web.UI.WebControls.EntityDataSourceView.ExecuteDelete(IDictionary keys, IDictionary oldValues) +386
   System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary oldValues, DataSourceViewOperationCallback callback) +89
   Telerik.Web.UI.GridTableView.PerformDelete(GridEditableItem editedItem, Boolean suppressRebind) +265
   Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source) +4320
   Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +191
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +165
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +118
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


I have no code behind (nice) and the column markup looks like:

<

 

telerik:GridNumericColumn UniqueName="freightRate" SortExpression="freightRate"

 

 

HeaderText="Freight Rate" DataField="freightRate" ColumnEditorID="GridNumericColumnEditor1"

 

 

FooterText="Freight Rate" NumericType="Currency" DataType="System.Decimal">

 

 

</telerik:GridNumericColumn>

 


Is it because the NumericType? Should i use a Dataformatstring instead? thanks.

rw

8 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 12 May 2009, 08:20 AM
Hi Rich,

I suspect that the behavior you have described is related to the way EntityDataSource is converting values when an entity instance is constructed and it seems that it cannot parse correctly the string values with formatting. Same behavior can be observed with MS's GridView control too.
In order to workaround this shortcoming of EntityDataSource you may consider removing the value formatting of the column.

All the best,
Rosen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rich
Top achievements
Rank 1
answered on 13 May 2009, 03:07 PM
That is lame.

Will SQL datasource have the same issue?  Doesn't make a lot of sense.. This is just a guess, but i'm thinking other people may want their data to be formatted when viewed in the grid..

We need (Well maybe i just want ;') ) a webapplication generator, blinq style with rad controls.. that doesn't suck.

Rich
0
Rosen
Telerik team
answered on 16 May 2009, 06:49 AM
Hi Rich,

No, SqlDataSource, as LinqDataSource etc. will work correctly in this case.  As I stated the issue seems to be how EntityDataSource converts string values to double when the string representation is formatted and is not related to our RadGrid control. 

All the best,
Rosen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Paul Wood
Top achievements
Rank 1
answered on 01 Dec 2011, 01:49 AM
Except I have now encountered this with a LinqDataSource. I get the following error:

System.Web.UI.WebControls.
LinqDataSourceValidationException: Failed to set one or more properties on type DataContext.CA_Deals_Items. $249.00 is not a valid value for Decimal.

With GridNumericColumn it fails, whereas with GridTemplateColumn using a RadNumericTextBox, no such issues

<MasterTableView AllowAutomaticDeletes="True"........
 
<telerik:GridNumericColumn UniqueName="RRP" DataField="RRP" HeaderText="RRP" NumericType="Currency" />
 
<telerik:GridTemplateColumn UniqueName="RRP" DataField="RRP" HeaderText="RRP">
  <ItemTemplate>
    <asp:Literal ID="ltlRRP" runat="server" Text='<%#Eval("RRP", "{0:c2}")%>' />
  </ItemTemplate>
  <EditItemTemplate>
    <telerik:RadNumericTextBox ID="tbxRRP" runat="server" DbValue='<%#Bind("RRP")%>' Type="Currency" />
  </EditItemTemplate>
</telerik:GridTemplateColumn>
0
Paul Wood
Top achievements
Rank 1
answered on 01 Dec 2011, 01:50 AM
accidental duplicate
0
Radoslav
Telerik team
answered on 05 Dec 2011, 10:11 AM
Hi Paul,

I tried to reproduce the described issue but to no avail. I am sending you a simple example please check it out and let me know what differs in your case. Looking forward for your reply.

Regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Paul Wood
Top achievements
Rank 1
answered on 06 Dec 2011, 05:52 AM
My database field is of type SmallMoney for the Currency field (on a MS SQL 2008 database) with UpdateCheck set to Never on the DataContext. I also have a Where and an OrderBy on my LinqDataSource. EditMode is PopUp

Other than that I can't see anything else different that is relevant
0
Radoslav
Telerik team
answered on 08 Dec 2011, 02:30 PM
Hello Paul,

I still could not reproduce the described issue. I am sending you a modified example which has additional Currency column of type SmallMoney. Also I set Where and an OrderBy clauses to the LinqDataSource and EditMode=”PopUp” to the grid, however everything works as expected. It will be helpful if you send us a small runnable example which demonstrates the described issue. Thus we will be able to gather more details about your scenario, debug the application and investigate the problem.

Looking forward for your reply.

All the best,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Rich
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Rich
Top achievements
Rank 1
Paul Wood
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or