0

On my page I have FormView control, and I am binding Integer database field to the TextBox that's residing inside a FormView's EditItemTemplate.

<FormView ...>
    <EditItemTemplate> 
        <dx:ASPxTextBox ID="txtDiameter" runat="server" Text='<%# Bind("Diameter") %>' />
        ... 
    <EditItemTemplate>
    ... 
</FormView>

My problem is that when Diameter field is null, the txtDiameter gets value of empty string. When I click Update command (if I didn't provide any numerical value in txtDiameter), a client error is raised

Sys.WebForms.PageRequestManagerServerErrorException: is not a valid value for Int32.

I found some post from 2005 that claims that this is happening due to some bug. Well, now is 2012. The only way I figured how to deal with this is by using FormView_ItemUpdating event, to circle through all problematic values and convert them from String.Empty to null.

I am just little suspicious that it's maybe not necessary. Is there another way to deal with this problem?

1 Answer 1

2

Bind the editor's Value property instead:

<dx:ASPxTextBox ID="txtDiameter" runat="server" Value='<%# Bind("Diameter") %>' />

Does this work?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.