Focus when Cancel is clicked on dataform

4 posts, 0 answers
  1. Sumati
    Sumati avatar
    22 posts
    Member since:
    Jun 2010

    Posted 02 Jul 2010 Link to this post

    Hi,

    I have a dataform with few controls, Commit and Cancel button.

    Now user can type data in textboxes. If user click's on cancel button then the focus is not back on the last edited control
    Infact focus is nowhere. User has to click on dataform to get a focus on last edited control.

    How can I make it that when 'Cancel' action is done then focus should be on last edited control?
  2. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 02 Jul 2010 Link to this post

    Hi Sumati,

    Is this DataForm somehow related to RadGridView?


    Kind regards,
    Milan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Sumati
    Sumati avatar
    22 posts
    Member since:
    Jun 2010

    Posted 02 Jul 2010 Link to this post

    No its a simple dataform with 3 textboxes, 6 drop downs, Commit button and Cancel button
  4. Sumati
    Sumati avatar
    22 posts
    Member since:
    Jun 2010

    Posted 02 Jul 2010 Link to this post

    Following is the code for reference:

    void

     

    Form_EditEnding(object sender, DataFormEditEndingEventArgs e)

     

    {

     

        if (e.EditAction == DataFormEditAction.Cancel)

     

        {

     

            if (MessageBoxResult.Cancel == MessageBox.Show("Are you sure you want to Cancel? \nClick OK
    to proceed or Cancel to return"
    , "Confirm", MessageBoxButton.OKCancel))

     

            e.Cancel =

    true;

     

        }

    }

    When e.Cancel = true; is executed then I want focus on last edited control but is is not happening
    Even if I explicity write code to focus control then also it is not working

Back to Top