Steps:
- Select any row in grid. Dataform is in readonly mode.
- Click 'Add' button of dataform.
- Change row selection from grid without clicking on commit button(ok). Now every row in dataform is editable. It should be readonly defaultly.
How I can fix this problem? I have tried it to fix by calling
CommitEdit()
on grid row selection change. But no luck.Please suggest asap its urgent.
7 Answers, 1 is accepted
Indeed, you are quite correct - I managed to reproduce the behavior you described. My suggestion would be to handle SelectionChanging event of the grid and call CommitEdit() method of RadDataForm. I am sending you a sample project illustrating this approach.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
But I am using Microsoft listbox with rad dataform. So in listbox there is no selection chenging event. I have tried in selection chenged event of listbox but no luck. Please suggest some workaround to fix this bug.
private
void lstAssignments_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
radDataForm.CommitEdit();
}
Thanks in advance for quick reply.
We will consider modifying the logic for such cases, but still there is a bit of confusion whether the changes should be committed and the data form to go out of edit mode or not (for example what should be the case when there are validation errors). Still, we will investigate the requirements and consider what should be the best possible way to go.
What I could suggest is to handle the current item change event for example and invoke the CommitEdit() method of the data form there.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Thanks for answer.
But It is also not working. I want same behaviour as I am clicking on edit button. On selection change dataform should come as readonly. Validations I can take care on save button.
private
void
radDataForm1_AddedNewItem(
object
sender, Telerik.Windows.Controls.Data.DataForm.AddedNewItemEventArgs e)
{
radDataForm1.CommitEdit();
radDataForm1.BeginEdit();
}
Depending on your exact requirements, you can try something like follows:
private void myRadDataForm_LostFocus(object sender, RoutedEventArgs e)
{
if (FocusManager.GetFocusedElement() is System.Windows.Controls.ListBox || FocusManager.GetFocusedElement() is System.Windows.Controls.ListBoxItem)
{
this.myRadDataForm.CancelEdit();
}
}
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>