We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

control lost focus

Thread ID:

Created:

Updated:

Platform:

Replies:

40795 Feb 13,2006 08:18 PM UTC Feb 26,2018 10:45 AM UTC Windows Forms 9
loading
Tags: GridControl
Hui Zhong
Asked On February 13, 2006 08:18 PM UTC

When the grid control lost focus, we need to save some data. Is there any event with CancelEventArgs raised at this case, so I can use e.cancel = true to prevent this grid control to lose focus? Thanks Hui

Administrator [Syncfusion]
Replied On February 14, 2006 07:29 AM UTC

Hi Hui, There is no event with CancelEventArg on control lost focus. But the focus can be set back in the LostFocus event handler by calling the grid.Focus(); method, which wont allow the focus to be lost. Regards, Calvin.

Hui Zhong
Replied On February 14, 2006 04:18 PM UTC

Please see the attached example. Our original design is to save the data when the row is changed or the grid control lost focus, which could be the case like the user click other control on the form, or this form closed. If save fails, we want to display the error messge, and the grid control get focus again. If set the debug point in the event of gridControl1_LostFocus, gridControl1.Focus() does work. However, if there is no debug point set there, the LostFocus event is not raised, and the gridControl1 does lose control. Hui >Hi Hui, > >There is no event with CancelEventArg on control lost focus. But the focus can be set back in the LostFocus event handler by calling the grid.Focus(); method, which wont allow the focus to be lost. > >Regards, >Calvin.

WindowsApplication25.zip

Administrator [Syncfusion]
Replied On February 15, 2006 04:40 PM UTC

Hi Hui, Try handling the Grid’s Validating event to see if that helps. Attached a sample. Regards, Calvin.

40795.zip

Hui Zhong
Replied On February 15, 2006 05:53 PM UTC

Thanks, Calvin. Actually yesterday after I sent my example code, I tried the Validating event, it worked for me. However, when I merge this code to our project. The validating was not raised if clicking other control on the form. I will try to figure out why, and may come back to you later. Hui >Hi Hui, > >Try handling the Grid’s Validating event to see if that helps. Attached a sample. > >Regards, >Calvin.

40795.zip

Hui Zhong
Replied On February 15, 2006 09:59 PM UTC

I figured it out. When the grid control is added at runtime, set tabindex = 0 will raise the validating event when move the focus out of this grid control >Thanks, Calvin. >Actually yesterday after I sent my example code, I tried the Validating event, it worked for me. > >However, when I merge this code to our project. The validating was not raised if clicking other control on the form. > >I will try to figure out why, and may come back to you later. > >Hui > >>Hi Hui, >> >>Try handling the Grid’s Validating event to see if that helps. Attached a sample. >> >>Regards, >>Calvin.

40795.zip

Hui Zhong
Replied On February 16, 2006 06:21 PM UTC

I still have some problems with the validating event. I don''t have the issue with the example, because the event handling is quite simple. However, in the project I am working on, we implemented a lot events, and the validating() event of the grid is not raised when I clicked on other controls (like button..) in the form. Do you have some idea on it? Thanks. Hui > >I figured it out. When the grid control is added at runtime, set tabindex = 0 will raise the validating event when move the focus out of this grid control > >>Thanks, Calvin. >>Actually yesterday after I sent my example code, I tried the Validating event, it worked for me. >> >>However, when I merge this code to our project. The validating was not raised if clicking other control on the form. >> >>I will try to figure out why, and may come back to you later. >> >>Hui >> >>>Hi Hui, >>> >>>Try handling the Grid’s Validating event to see if that helps. Attached a sample. >>> >>>Regards, >>>Calvin.

40795.zip

stanleyj [Syncfusion]
Replied On February 17, 2006 02:08 PM UTC

Hi Hui, Please ensure that CausesValidation of those controls like button are set to true. Best regards, Stanley

park
Replied On February 26, 2018 01:26 AM UTC

Hi Hui, Try handling the Grid’s Validating event to see if that helps. Attached a sample. Regards, Calvin.

40795.zip

ok

Sindhu Nagarajan [Syncfusion]
Replied On February 26, 2018 10:45 AM UTC

Hi Hui, 
  
Thanks for your update.  
Please let us know if you have any other queries. 
  
  
Regards, 
Sindhu. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;