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.
Unfortunately, activation email could not send to your email. Please try again.

Validating date cell in GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

52500 Nov 29,2006 10:04 AM Dec 13,2006 11:48 PM Windows Forms 4
loading
Tags: GridControl
Sebastien Vassord
Asked On November 29, 2006 10:04 AM

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

Sebastien Vassord
Replied On November 29, 2006 10:11 AM

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

Administrator [Syncfusion]
Replied On November 30, 2006 04:41 AM

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

Sebastien Vassord
Replied On December 13, 2006 09:06 AM

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

Administrator [Syncfusion]
Replied On December 13, 2006 11:48 PM

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

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.

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.

;