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

RadmaskedTextbox in radgrid template generates error formatted as phone number

1 Answer 94 Views
Input
This is a migrated thread and some comments may be shown as answers.
Bill Deihl
Top achievements
Rank 2
Bill Deihl asked on 15 Sep 2008, 09:46 PM

I have a table with a phone number stored as a long/nullable. (I can’t change it…)

All is well except for editing the record with an empty fax number in this case. An error dialog tells me that I don’t have a valid value for int64.

If I input a value of 0 in the radmaskedtextbox the record saves but then I have a 0 for the fax number. I need it to be blank/null if there is no number entered

Thanks for any help!

Bill

<telerik:GridBoundColumn DataField="AgencyMainFax" DataType="System.Int64" HeaderText="Main Fax" DataFormatString="{0:(###) ###-####}"  AllowFiltering="false" SortExpression="AgencyMainFax" UniqueName="AgencyMainFax">

</telerik:GridBoundColumn>

The edittemplate:

<telerik:radmaskedtextbox ID="RadMaskedTextBox2" runat="server" Mask="(###) ###-####"

Text='<%# Bind("AgencyMainFax") %>' Width="125px">

</telerik:radmaskedtextbox>

 

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 18 Sep 2008, 01:32 PM
Hello Bill Deihl,

Instead of using "Text" property for binding the value you could try using the "Value" property or the other tree analogs of text properties which should not returns 0 but just null.
Please test this approaches and let us know if this helps.

Sincerely yours,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Input
Asked by
Bill Deihl
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Share this question
or