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

On row selection change in grid dataform is not coming in readonly mode after add new row.

7 Answers 120 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Manoj
Top achievements
Rank 1
Manoj asked on 13 Oct 2011, 09:26 PM
To reproduce this problem please use 'ICollectionView Synchronization' example in demo of dataForm.
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

Sort by
0
Maya
Telerik team
answered on 17 Oct 2011, 09:31 AM
Hi Manoj,

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.
 

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Manoj
Top achievements
Rank 1
answered on 17 Oct 2011, 05:57 PM
Thanks Maya,

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.

 

0
Maya
Telerik team
answered on 18 Oct 2011, 05:50 PM
Hello Manoj,

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.
 

Best wishes,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Manoj
Top achievements
Rank 1
answered on 18 Oct 2011, 08:22 PM
Hi Maya,

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.
0
Manoj
Top achievements
Rank 1
answered on 18 Oct 2011, 08:29 PM
Is there any way to have selection changing event in list box similar to rad datagrid. So that I can call 'CommitEdit()' in that.
0
Manoj
Top achievements
Rank 1
answered on 18 Oct 2011, 08:44 PM
If I do as follows then problem can be fixed but I am not giving user chance to fill required fields to user. Please suggest some solution.

 

 

private void radDataForm1_AddedNewItem(object sender, Telerik.Windows.Controls.Data.DataForm.AddedNewItemEventArgs e)
radDataForm1.CommitEdit();
radDataForm1.BeginEdit();
}

0
Accepted
Maya
Telerik team
answered on 19 Oct 2011, 08:42 AM
Hello Manoj,

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();
                 
            }
        }
 

Best wishes,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
DataForm
Asked by
Manoj
Top achievements
Rank 1
Answers by
Maya
Telerik team
Manoj
Top achievements
Rank 1
Share this question
or