Grid Control

1. Is it possible to create a calendar control with a masked eidt box in the same cell?
2. Is it possible to have a autocomplete control in a cell?

Thanks,

Scott



1 Reply

NA Nisha Arockiya A Syncfusion Team January 23, 2009 01:04 PM UTC


Hi Scott,

Thanks for your interest in syncfusion Products.

Currently there is no cell style that mixes a maskedit with a dropdown calendar.

One possible solution is to handle the CurrentCellValidateString method and verify the text is valid with each keystroke. Below is some code snippets. Here is a sample showing this method.





private void Form1_Load(object sender, System.EventArgs e)

{

this.gridControl1[4, 2].BackColor = Color.LightPink;

this.gridControl1[4, 2].CellType = "MonthCalendar";

this.gridControl1[4, 2].CellValue = DateTime.Now;

this.gridControl1[4, 2].CellValueType = typeof(DateTime);

this.gridControl1[4, 2].Format = "M/d/yyyy";

}

private void gridControl1_CurrentCellValidateString(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellValidateStringEventArgs e)

{

GridCurrentCell cc = this.gridControl1.CurrentCell;

if(cc.RowIndex == 1 && cc.ColIndex == 1)

{

try

{

DateTime dt = DateTime.Parse(e.Text);

}

catch

{

e.Cancel = true;

}

}

}





The second option is to use our DateTimePicker in a cell and format it. Here is a sample showing this implementation.

Please let me know if this serve your needs.

Regards,
Nisha.BR>


Loader.
Up arrow icon