Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
465
CustomDateTimeEditor in grid
posted

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

 

CustomDateTime.zip
Parents
  • 469350
    Offline posted

    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.

Reply Children