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.
Syncfusion Feedback

DateTimeCellModel Calenadar appears in wrong place

Thread ID:

Created:

Updated:

Platform:

Replies:

68746 Oct 1,2007 04:33 AM Oct 2,2007 04:52 AM Windows Forms 3
loading
Tags: GridControl
Valerij
Asked On October 1, 2007 04:33 AM

There is a strange behaviour in DateTimeCellModel.

Example attached.

Step 0: Run attached solution
Step 1: Single click on one of grid cells
Step 2: Now click on the textbox in right upper corner
Step 3: Click on "dropdown" button (with small triangle) in previously clicked cell

Calendar appears in right bottom corner of the screen. How can I fix this problem?

DateTimePickerCellBug.zip

Administrator [Syncfusion]
Replied On October 1, 2007 11:08 AM

You can avoid the problem by hiding the DatTimePicker when the grid loses focus. At the bottom of the renderer's contructor, add this code to subscribe to the event.


grid.LostFocus += new EventHandler(grid_LostFocus);


Then use this handler.


void grid_LostFocus(object sender, EventArgs e)
{
if (dateTimePicker.Visible)
{
this.dateTimePicker.Hide();
}
}


Valerij
Replied On October 2, 2007 03:27 AM

You mean something like this for GDBG:

void gridDataBoundGrid1_LostFocus(object sender, EventArgs e)
{
if (gridDataBoundGrid1.CurrentCell.Renderer.Control.Visible)
gridDataBoundGrid1.CurrentCell.Renderer.Control.Hide();
}
?

Is there a way to avoid this problem at DateTimeCellModel component level? I need to implement datetimepicker cell in quite big application where a lot grids are used. It would be much easer to make changes in one place then add event handler to each grid.

Administrator [Syncfusion]
Replied On October 2, 2007 04:52 AM

I was suggesting doing this in the renderer code.


public DateTimeCellRenderer(GridControlBase grid, GridCellModelBase cellModel)
: base(grid, cellModel)
{
dateTimePicker = new MyDateTimePicker();

dateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Short;
dateTimePicker.NullString = "";
dateTimePicker.ShowUpDown = false;
dateTimePicker.ShowCheckBox = false;
dateTimePicker.ShowDropButton = true;
dateTimePicker.Border3DStyle = Border3DStyle.Flat;

grid.Controls.Add(dateTimePicker);

//show & hide to make sure it is initilized properly for teh first use...
dateTimePicker.Show();
dateTimePicker.Hide();

this.SetControl(dateTimePicker);

grid.LostFocus += new EventHandler(grid_LostFocus);//added.......
}

//added.......
void grid_LostFocus(object sender, EventArgs e)
{
if (dateTimePicker.Visible)
{
this.dateTimePicker.Hide();
}
}

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.

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

;