MonthCalender cell in Grid

Hi,

I have attached my code here. I have MonthCalender cell in my grid now i have to restrict the user from entering the text in this cell.
I have tried with different dropdownstyles but it's not working.Can you please suggest me the better solution.

Thanks






MonthCalender.zip

1 Reply

JS Jeba S Syncfusion Team January 14, 2008 05:20 PM UTC

Hi Sunitha,

If you want to avoid your user entering the text in MonthCalender cell, then you can try using CurrentCellValidateString. This event is hit keystroke by keystroke and you can test e.Inner.Text to see if it is something you want to accept.

Below is the code snippet:

private void gridGroupingControl1_TableControlCurrentCellValidateString(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellValidateStringEventArgs e)
{
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
if(cc.RowIndex >=4 && cc.ColIndex == 3)
{
try
{
DateTime dt = DateTime.Parse(e.Inner.Text);
}
catch
{
e.Inner.Cancel = true;
}
}
}

Please refer to the below KB article for more details on Validation of a cell.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=340

Kindly let us know if you need any further assistance.

Regards,
Jeba.



Loader.
Up arrow icon