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

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

AS Asarudheen S Syncfusion Team October 6, 2011 04:44 AM UTC

Hi Ram,

Thank you for you interest in Syncfusion products.

You can validate a cell using by using “CurrentCellValidating” event. Please make use of following code to achieve the behavior.


void gridControl1_CurrentCellValidating(object sender, CancelEventArgs e)
{
if (this.gridControl1.CurrentCell.Renderer is GridTextBoxCellRenderer)
{
GridTextBoxCellRenderer ren = this.gridControl1.CurrentCell.Renderer as GridTextBoxCellRenderer;
if (ren.TextBox.Text == "Software")
e.Cancel = true;

}
}



Here is the sample for your reference.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=101155-794095752.zip

Please let us know if you need any further assistance.

Regards,
Asarudheen.



Loader.
Live Chat Icon For mobile
Up arrow icon