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

8 posts, 1 answers
  1. Manoj
    Manoj avatar
    43 posts
    Member since:
    Aug 2011

    Posted 13 Oct 2011 Link to this post

    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. 
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 17 Oct 2011 Link to this post

    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 >>

  3. DevCraft banner
  4. Manoj
    Manoj avatar
    43 posts
    Member since:
    Aug 2011

    Posted 17 Oct 2011 Link to this post

    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.

     

  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 18 Oct 2011 Link to this post

    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 >>

  6. Manoj
    Manoj avatar
    43 posts
    Member since:
    Aug 2011

    Posted 18 Oct 2011 Link to this post

    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.
  7. Manoj
    Manoj avatar
    43 posts
    Member since:
    Aug 2011

    Posted 18 Oct 2011 Link to this post

    Is there any way to have selection changing event in list box similar to rad datagrid. So that I can call 'CommitEdit()' in that.
  8. Manoj
    Manoj avatar
    43 posts
    Member since:
    Aug 2011

    Posted 18 Oct 2011 Link to this post

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

  9. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 19 Oct 2011 Link to this post

    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 >>

Back to Top
DevCraft banner