
I have following column amongst other columns:
...
<grid:GridViewDataColumn IsReadOnly="False" IsSortable="False" Header="Comment"
DataMemberBinding="{Binding Comment}" MaxWidth="250" IsResizable="False" >
<grid:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<TextBox Text="{Binding Comment}" MaxLength="50" />
</DataTemplate>
</grid:GridViewDataColumn.CellEditTemplate>
</grid:GridViewDataColumn>
...
Issue:
When there is more than one row in the grid, editing of this cell can be ended in whatever way (by focusing on some other field, pressing enter... etc.) and the grid will retain the value entered. Such value will also be updated into the database by:
private
void radGridView1_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
{...}
However, when there is only one row in the grid, pressing enter to end the cell edit works for retaining the value just entered for the cell but not triggering "CellEditEnded". Therefore, the value entered is not being put into the database...
Is there anyway someone help me with this?
Thanks for your time in advance,
K
6 Answers, 1 is accepted
I could not reproduce the problem. Please find attached my test project. Let me know if you manage to reproduce it.
All the best,
Veselin Vasilev
the Telerik team

Have you tried adding "MaxLength="x"" where x (for your solution) is 10.
I have not been able to reproduce yet, partly because what you have is totally different than what I got. But when the cell is edited twice, whole row disappears...
I'll be trying some more. Thanks so far.

The problem in my post before this does not occur when:
clubsGrid.ItemsSource =
Club.GetClubs().Where(c => c.Name == "Liverpool");
is changed to => clubsGrid.ItemsSource = Club.GetClubs();
... As I mentioned in my first post, there is something happening differently when there is only one row than there are more rows. (And, I figured, this has nothing to do with MaxLength property...)
I think my problem is also caused by having one row... Please let me know what you find.
K
Unfortunately, I am not able to reproduce the issue even if:
clubsGrid.ItemsSource = Club.GetClubs();
and the CellEditEnded is fired as expected no matter if you are editing the column with predefined CellEditTemplate or any of the others.
So, I would need a bit more information, mostly about the exact way of reproducing the issue - is there anything specific you are doing when editing or some additional property you are setting?
Greetings,
Maya
the Telerik team

Here is some more information I can give:
1) I am not using ObservableCollection<T>, I'm using List<T>(Documentation does not say I have to use ObservableCollection => http://www.telerik.com/help/wpf/gridview-configuring-the-databindings.html)
2) The field is from LINQ to SQL class
3) The field allows null...
The problem occurs only at the last row by ending edit with ENTER on the field that "allows null".
Pressing enter key "normally" ends the edit and moves the cursor to the same column but one row below(* in this case)...
In the case of ending edit at the last column with ENTER, well, I think entered value is being ignored because the cursor cannot focus somewhere else?!? UI shows everything is OK but, in fact, the SubmitChange() at CellEditEnded does not receive the "change" from the grid.
Did I clarify some?
K
Please send us a sample project illustrating the issue so that we skip any misunderstandings on your requirements and project settings. In case it is more suitable for you, you may modify the application attached in this forum thread and send it through support ticket.
Thank you for the cooperation.
Maya
the Telerik team