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

Validating date cell in GridDataBoundGrid

Hi to all,

i have a problem with the validation of a date cell in a GridDataBoundGrid.

i got this error message :

"Impossible to define column 'Date_X' to null. Try DBNull instead"

i tried the following snipped code that i took on this forum but it only works with the GridControl.

if (gridControl1.CurrentCell.ColIndex == 7)
{
try
{
CultureInfo oCultureInfo = new
CultureInfo(CultureInfo.CurrentCulture.LCID);

DateTime.ParseExact (gridControl1.CurrentCell.Renderer.ControlText, "dd/MM/yyyy", oCultureInfo, DateTimeStyles.AllowWhiteSpaces);
}
catch
{
gridControl1.CurrentCell.Renderer.ControlValue
= gridControl1.Model[gridControl1.CurrentCell.RowIndex, gridControl1.CurrentCell.ColIndex].CellValue;
}
}

how can i do to make it work with the GridDataBoundGrid

Best regards and thanks in advance

Sebastien Vassord

4 Replies

SV Sebastien Vassord November 29, 2006 03:11 PM UTC

Click on the link to see the snipped code i have took.

http://www.syncfusion.com/support/Forums/message.aspx?MessageID=43341

Best regards and thanks in advance

Sebastien Vassord


AD Administrator Syncfusion Team November 30, 2006 09:41 AM UTC

Hi Sebastien,

We were not able to reproduce the issue here. Is it possible for you to upload us a sample or modify the attached sample to reproduce the issue here? This will help us to analyse the issue further.

Here is a sample.
GDBGDateTimeValidate.zip

Best Regards,
Haneef


SV Sebastien Vassord December 13, 2006 02:06 PM UTC

Hi to all,

I have this problem of the validation with a Mask Edit cell, not with MonthCalendar Cell.

I define the cell like the following snipped code :

GridBoundColumn oBCol = = new GridBoundColumn();
oBCol.StyleInfo.CellType = "MaskEdit";
oBCol.StyleInfo.MaskEdit.Mask = "99/99/9999";
oBCol.StyleInfo.MaskEdit.PromptCharacter = '_';
oBCol.StyleInfo.MaskEdit.PaddingCharacter = '_';



Best regards and thanks in advance

Sebastien Vassord


AD Administrator Syncfusion Team December 14, 2006 04:48 AM UTC

Hi Sebastien,

Thanks for your update. The attached sample shows you How to validate the MaskEdit cell with DateTime datatype. It implements the MaskSatisfied event for setting the Renderer.ControlText and handle CurrentCellValidating event for validating the cell. Please refer to the attached sample for more details.

Sample : GDBGDateTimeMaskEdit.zip

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon