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.

Problem with custom cell type in GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

35144 Sep 23,2005 12:09 PM Sep 26,2005 04:08 PM Windows Forms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On September 23, 2005 12:09 PM

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 23, 2005 08:13 PM

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))
	{
		this.FixControlParent(_editDateTimePicker);

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

	}
	else
	{
		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 02:46 PM

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 03:24 PM

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 04:08 PM

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.

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.

;