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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Check if cell is empty

Thread ID:

Created:

Updated:

Platform:

Replies:

130312 May 5,2017 08:26 PM UTC May 8,2017 01:54 PM UTC WinForms 1
loading
Tags: GridGroupingControl
Josip Pejakovic
Asked On May 5, 2017 08:33 PM UTC

HelloHow to check if cell is empty after loosing focus?The problem I'm facing with is saving values from programatically binded gridgrouping control. The one of fields should not be empty (not null) and I need to check and/or inform user to check specific field before saving.

Mohanraj Gunasekaran [Syncfusion]
Replied On May 8, 2017 01:54 PM UTC

Hi Josip,  
 
Thanks for using Syncfusion products.  
 
Query 
Solution 
How to check if cell is empty after loosing focus? 
In order to validate the cell value when losing the focus, you can use the SetError method in CurrentCellValidating event. Please refer to the below code example, 
 
Code example 
this.gridGroupingControl1.TableControl.CurrentCellValidating +=TableControl_CurrentCellValidating; 
 
void TableControl_CurrentCellValidating(object sender, CancelEventArgs e) 
{ 
    GridCurrentCell currentCell = this.gridGroupingControl1.TableControl.CurrentCell; 
    GridTableCellStyleInfo style = this.gridGroupingControl1.TableControl.GetTableViewStyleInfo(currentCell.RowIndex, currentCell.ColIndex); 
    if (String.IsNullOrEmpty(currentCell.Renderer.ControlText)) 
    { 
        currentCell.SetError("Please enter the valid data"); 
    } 
} 
 
Please refer the below UG link: 
The problem I'm facing with is saving values from programatically binded gridgrouping control. The one of fields should not be empty (not null) and I need to check and/or inform user to check specific field before saving. 
By default, the GridGroupingControl does not have the support to validate the cell value while updating the value programmatically because you can check the value using String.IsNullOrEmpty method when you update the value programmatically. If we misunderstood your scenario, please provide your updating details or provide the simple sample to understand your scenario. It will be helpful to provide the solution at the earliest. 
 
 
  
Sample link: GridGroupingCotnrol  
 
Regards,  
Mohanraj G  
 


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

;