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

Issue w/ editing databound gridmaskedcolumn

1 Answer 53 Views
Input
This is a migrated thread and some comments may be shown as answers.
Vin
Top achievements
Rank 1
Vin asked on 18 Nov 2010, 10:38 PM
Have a grid w/ in-place editing enabled. One of the fields stores a dollar amount (unit price) which is databound to my sql database via an sqldatasource, decimal(10,2) field. The column definition is as follows:

 

<telerik:GridMaskedColumn DataField="UnitPrice" DisplayMask="" 
HeaderText="Unit Price" Mask="$##,###.##" UniqueName="Unit Price" 
DataFormatString="{0:C2}"
<HeaderStyle HorizontalAlign="Center" Width="100px" /> 
<ItemStyle HorizontalAlign="Center" Width="100px" /> 
</telerik:GridMaskedColumn>

Let's take an item with a unit price of $110.00 from the database.

When the grid initially loads, the column properly displays the amount as $110.00

If I click edit, my in-place editing form appears and the input box for the unit price appears as:

$11,0__.00

Suffice to say, this is clearly incorrect. There are other editable columns in the grid... if the user intends to edit a different field (such as description) they also have to "correct" the incorrect unit price -- each and every time they perform an edit operation -- otherwise if they attempt to update w/o correcting it, they receive a "Exception Details: System.FormatException: Input string was not in a correct format." error when trying to update. This is very annoying to the user community.

Why is the masked control displaying the data incorrectly for edit, and how can I correct it so the value is properly displayed on the edit form to avoid this issue?

1 Answer, 1 is accepted

Sort by
0
Vin
Top achievements
Rank 1
answered on 23 Nov 2010, 08:47 PM
Figured it out. Don't use the masked control, use the radnumeric control and set type to currency.

Thanks for all the replies. Great community forum here.
Tags
Input
Asked by
Vin
Top achievements
Rank 1
Answers by
Vin
Top achievements
Rank 1
Share this question
or