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

nullable types with CellEditTemplate : cannot change value to blank one

2 Answers 19 Views
GridView
This is a migrated thread and some comments may be shown as answers.
LE DREAU Steeve
Top achievements
Rank 1
LE DREAU Steeve asked on 15 Apr 2011, 03:38 PM
Hi all,

I wanted to know why when I use celledittemplates within nullable types I can't change a value to a blank one and then validate it.
Here is an example :

<telerik:GridViewDataColumn Header="DataColumn avec templates" DataMemberBinding="{Binding Age}">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Age}" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                    <telerik:GridViewDataColumn.CellEditTemplate>
                        <DataTemplate>
                            <TextBox Text="{Binding Age, Mode=TwoWay}" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellEditTemplate>
                </telerik:GridViewDataColumn>

The Age property type is Integer? so I should be able to delete the Age value from the cell edit template and then validate the row. This cell should display a blank cell but the old value is still here.

Could you please help me to figure why there is this problem please ?
Thanks

Regards

Steeve

2 Answers, 1 is accepted

Sort by
0
Accepted
Vanya Pavlova
Telerik team
answered on 15 Apr 2011, 04:16 PM
Hello Steeve,

 

Indeed the behavior you get is the expected one. I believe that it is related to the TextBox control rather than to RadGridView, you may read more about this here. Basically you may create a converter to convert all empty string to null and then it will work. 


Please find attached sample project that demonstrates this approach.



Regards,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
LE DREAU Steeve
Top achievements
Rank 1
answered on 15 Apr 2011, 04:41 PM
Thanks for your answer, it's exactly that... I totally forgotten about the converter...
Sorry for this poor question ^^
Tags
GridView
Asked by
LE DREAU Steeve
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
LE DREAU Steeve
Top achievements
Rank 1
Share this question
or