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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem with custom cell type in GridDataBoundGrid

Thread ID:





35144 Sep 23,2005 04:09 PM UTC Sep 26,2005 08:08 PM UTC WinForms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On September 23, 2005 04:09 PM UTC

I''m trying to create a custom cell type (using model and renderer classes) for use in a GridDataBoundGrid. I looked at some of the sample projects to get an idea on how to do this. But my efforts have not fully succeeded. I am using a DateTimePicker control in cells, and the dates are displaying. Strange things happen, though, when I click around the grid between different DateTimePicker cells. If I enter one DateTimePicker cell and then enter another, the first one will display the value of the second. If I change a value, the DateTimePicker goes blank until I leave the cell. And when I leave the cell, other cells display the new value. I have been unable so far to figure out what it is going on. I have included a sample app that showcases this problem. Thanks for your help, Brian GDBG_CustomCell_Problem_8601.zip

Administrator [Syncfusion]
Replied On September 24, 2005 12:13 AM UTC

I tweaked your OnDraw as below to avoid the problem (essentially just positioning and showing the edit control without calling the base class).
protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style)
	clientRectangle.Size = GridUtil.Max(clientRectangle.Size, GridCellDateTimePickerModel.DateTimePickerControlSize);

	if (this.ShouldDrawFocused(rowIndex, colIndex))

		// Position current grid.
		this._editDateTimePicker.Size = clientRectangle.Size;
		this._editDateTimePicker.Location = clientRectangle.Location;
		if (!this._editDateTimePicker.ContainsFocus)

		style.Control = this._viewDateTimePicker;
		GridCellDateTimePickerModel.InitializeDateTimePicker(this._viewDateTimePicker, style);
		base.OnDraw (g, clientRectangle, rowIndex, colIndex, style);
If you just want a DateTimePicker cell, you can get one in this KB. http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=292

Administrator [Syncfusion]
Replied On September 26, 2005 06:46 PM UTC

Clay, That really didn''t seem to help. When moving from one DateTimePicker cell to another, the previous one will display the value of the current one until you move to a non-DateTimePicker cell. And if you move between numerous DateTimePicker cells, there''s a large flicker in cells that were visited. On a side note, I''m actually using a custom date control that another developer created. I used the DateTimePicker control as a means to eliminate the custom control as a problem. I see the same effects regardless of which control I use. The DateTimePicker kept things simpler when creating my sample. Brian

Administrator [Syncfusion]
Replied On September 26, 2005 07:24 PM UTC

Here is you sample back. With 3.3, I can change the value of one of the datetime cells, and then click on a another cell without seeing the duplicate values. Do you see the problem in this sample? http://www.syncfusion.com/Support/user/uploads/GDBG_CustomCell_Problem_9ecdf995.zip

Administrator [Syncfusion]
Replied On September 26, 2005 08:08 PM UTC

Thanks for your help, Clay. I noticed that I had a typo when I took your modified code. I had put RowIndex and ColIndex instead of rowIndex and colIndex in OnDraw. Somehow I missed that. Everything works just fine now.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon