Hi,
I am using Grid view and have a column defined as below.
and in code behind I have
When I am in edit mode, I get a textbox. If I do tab the value is saved. If I click anywhere else, the value is not saved. Also, if I am in the last cell, hitting tab goes outside the control and value is not saved. I have to hit shift+tab to save the content. This dramatically alters the user's behaviour.
Is there a way to save the edited value on lost focus? I tried UpdateSourceTrigger=LostFocus too. No luck.
Any help would be highly appreciated.
Pooran
I am using Grid view and have a column defined as below.
<telerik:GridViewDataColumn UniqueName="SiteName" Header="SiteName" DataMemberBinding="{Binding SiteName, Mode=TwoWay}" Width="120" > |
<telerik:GridViewDataColumn.CellTemplate> |
<DataTemplate> |
<TextBlock Text="{Binding SiteName}" /> |
</DataTemplate> |
</telerik:GridViewDataColumn.CellTemplate> |
<telerik:GridViewDataColumn.CellEditTemplate> |
<DataTemplate> |
<TextBox Text="{Binding SiteName, Mode=TwoWay}" MaxLength="20" Loaded="Editor_Loaded" /> |
</DataTemplate> |
</telerik:GridViewDataColumn.CellEditTemplate> |
</telerik:GridViewDataColumn> |
private void Editor_Loaded(object sender, RoutedEventArgs e) |
{ |
Control ctrl = sender as Control; |
if (ctrl != null) |
{ |
ctrl.Focus(); |
} |
} |
When I am in edit mode, I get a textbox. If I do tab the value is saved. If I click anywhere else, the value is not saved. Also, if I am in the last cell, hitting tab goes outside the control and value is not saved. I have to hit shift+tab to save the content. This dramatically alters the user's behaviour.
Is there a way to save the edited value on lost focus? I tried UpdateSourceTrigger=LostFocus too. No luck.
<TextBox Text="{Binding ProcedureName, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" MaxLength="20" Loaded="Editor_Loaded" /> |
Any help would be highly appreciated.
Pooran