Ticket Q253506
Visible to All Users

The CellEditorInitialize event isn't raised for edit cells that contain custom editors defined via templates.

created 15 years ago

I have two custom columns in an ASPxGridView which are bound to an in-memory data source independant of the gridviews datasource. Each custom column has an EditItemTemplate implementing the ITemplate interface. I can add/update and delete data using the gridview command controls.
My issue is:
I can't seem to locate the correct event handler to assign values to the EditItemTemplate controls whe a user edits the gridview row. The CellEditorInitialize event can't be used for custom editors. The controls within the editor are created at runtime based on data conditions and can be one of many DevExpress web editor controls.
Do I need to edit the custom ITemplate class to bind data to these controls so the controls have their correct unbound data values when editing? I am using the same ITemplate class for multiple gridviews and hence assigning values to the controls based on multiple detached datasources would be cumbersome.
The CellEditorInitialize event would have ben ideal in my situation.
Thanks.

Show previous comments (4)

    Hello,
    I don't know if anyone is actually reading my comments but "I KNOW THE CELLEDITORINITIALIZE EVENT ISN'T RAISED"
    None of the comments entered on this post have any value as they keep re-iterating the same information. As I've said, I successfully implemeted a custom Editor using the ITemplate interface so I know how to use it. I've already solved my issue and was looking for some "professional" guidance with the implementation of your API's.
    Vest, Katy I can appreciate that you're probably answering the same questions day in and day out but perhaps reading and understanding the question should be the first tack rather than a generic copy/paste approach.
    Please don't reply, as I'm afraid I'll just see another comment on the CellEditorInitialize event again.

    DevExpress Support Team 15 years ago

      Hello Graham,
      As you didn't close the report, it is still active and requires my assistance. Please accept my sincere apologies for misunderstanding this thread. However, let me explain my last answer about the ITemplate interface.
      Your initial question was:
      My issue is:
      I can't seem to locate the correct event handler to assign values to the EditItemTemplate controls whe a user edits the gridview row. The CellEditorInitialize event can't be used for custom editors. The controls within the editor are created at runtime based on data conditions and can be one of many DevExpress web editor controls.
      As templates are provided by ASP.NET, the answer is related to how they should be used properly. There is an interesting article, which provides information that I gave you earlier: Understanding Templates in ASP.NET: Implementing ITemplate. You should use the InstantiateIn method to determine when controls are created.
      > When I assign a value to a custom column control, which event should be used in the ITemplate method body?
      This method is called the first during templates initialization. There you can assign a value to required controls. Of course, you can do it in all other events: Init, Load, DataBinding, etc. However, you should always remember that the ASP.NET Page LifeCycle differs from a control life cycle, which is created at runtime. For example, when the page loads its ViewState and post data, this doesn't mean that your control will load them too. If you create a control (for example) in the PreRender event handler, of course, it won't have any post data.
      If you still need any further assistance on this item, please feel free to send us your project. We'll examine and fine-tune it.
      Thanks,
      Vest

        Oops, forgot about closing this. Hope it doesn't affect your performance metrics.
        BTW, your site is a wealth of information. Thank you for doing a fantastic job supporting your product(s)

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.