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. Image for the cookie policy date
close icon

validation: Required cell value

Is there a way we can specify validation on Grid Cell to make it required. (whether it is a string, datetime, currency etc)

Appreciate response.

Thanks,
Ram


1 Reply

RB Ragamathulla B Syncfusion Team September 30, 2011 05:59 AM UTC

Hi Ram.

Thank you for your interest in Syncfusion products.

You can be used to validate the changes that are made to a grid cell: CurrentCellValidateString and CurrentCellValidating. The CurrentCellValidateString is fired every time a key is pressed and the current text is passed as part of the EventArgs. The CurrentCellValidating is only fired once when the user tries to leave the current cell.

private void grid_CurrentCellValidating(object sender, CancelEventArgs e)
{
GridCurrentCell cc = this.grid.CurrentCell;

// Prevent user from blanking out cells in column 2.
if (cc.ColIndex == 2)
{
string val = cc.Renderer.ControlText;
if (val.Length == 0)
{

// No empty string in col 2.
e.Cancel = true;
}
}
if (cc.Renderer.StyleInfo.CellType == "DateTime")
{
//code
}

// Grid_CurrentCellValidating
}



Please refer to our UG link.

http://help.syncfusion.com/ug_93/User%20Interface/Windows%20Forms/Grid/Documents/5334howtovalidatechangesmadetoagridcell.htm

Hope this helpful for your reference.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GridValidation.doc1031007410.zip

Please let me know if you have further concerns.

Regards,
Ragamathullah B.


Loader.
Live Chat Icon For mobile
Up arrow icon