Hi,
I've created a date time user control that better suit the need of my client. It's composed of a UltraMaskedEdit and a MonthCalendar.
Everything is working fine on it's own. When I try to use it inside a grid, nothing seems to work.
I've attached a small sample project to demonstrate. The date shows as "01--" instead of "2011-12-01". Updating the value is not working, either by manually entering it or using the embedded MonthCalendar.
I know that implementing a user control inside a grid is a hard job, but I can't seem to figure out where to begin.
Any help would be appreciated
Chris.NetAdvantage Vol 2010.2
Hi Chris,
It's tough to tell, without really spending a huge amount of time reading this code, what you are trying to do here.
It looks like what you want is a Masked editor that drops down a MonthCalendar control. But why are you jumping through hoops to do this yourself instead of just using the DateTimeEditor - or the grid's default editor for any DateTime column.
What kind of functionality are you trying to add here?
When you embed an editor in the grid, that editor is going to get a whole lot of information from the grid column and ignore a whole lot of information on the control. So creating your own control that contains an UltraMaskedEdit control and returns the editor that that control provides is basically the same as simply setting the EditorControl property on the column to the UltraMaskedEdit control. Nothing you do to the Control will affect anything in the grid.
If you want to embed your own control in a grid cell, then trying to implement or mess around with the IProvidesEmbeddableEditor interface it incredibly complex and difficult and I don't think this approach is going to get you what you want.
It will be much easier and save you a lot of time to use the UltraControlContainerEditor component to embed your control directly into the cell, instead of trying to write your own custom editor.
Hi Mike,
What I'm trying to achieve with this custom control is the following: - Allows date below the 1753-01-01 to be manually entered - Never change the date automatically: ie 20-12-31 will become 2020-12-31 - Prevent the control to modify the date manually entered: ie entering '2', '0', '0', '1', '1', '3' will give "2001-1-3". - Allow the user to enter invalid date and have an errorProvider or message box instead: ie 2001-13-33 - Add properties to be able to easily bind to either a DateTime or DateTime?
Would it be maybe simpler, since I have your source code, to try to modify the UltraDateTimeEditor? Or am I going down an even riskier road.
I'll try to look at the UltraControlContainerEditor and see where this leads me.
Thanks