ItemEditTemplateSelector selects the editTemplate only for the first time - BUG?

4 posts, 0 answers
  1. tomas
    tomas avatar
    139 posts
    Member since:
    Sep 2012

    Posted 08 Nov 2012 Link to this post

    Hi TElerik,

    I am using

    ItemEditTemplateSelector

    This selector selects the right template according to properties of the databound object.

    When I change that values, the selector does not reflects these changes. The selector is not called at all. Only for the first time when an item is edited for the first time. After that, the same edit template is used.

    It seems to me this is a bug.

    Thank you.

    Tom

  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 13 Nov 2012 Link to this post

    Hi Tom,

    Let me make a quick clarification. All templates of the RadTreeVIew control are applied during the initialization of the control. After that they are cashed and called from memory for better performance and this is the expected behavior.

    However, if you need to reload the ItemEditTemplateSelector please send us a sample project demonstrating your scenario so we will be able to suggest the best approach in your case.

    Kind regards,
    Pavel R. Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. tomas
    tomas avatar
    139 posts
    Member since:
    Sep 2012

    Posted 13 Nov 2012 Link to this post

    I would like to send you attachment, but it is not possible.

    For entire solution submit a support ticket with attachment. 

    I can not find how to submit anything from this page.

    There is a menu Support, but there is only:

    Get support,
    view support tickets
    tracked forums
    issue tracker
    phone assistance
    remote web assistance

    ???

    Anyway, your web is very slow ...

    Please download here

    http://www.uschovna.cz/zasilka/K1US34NN3XX53DA5-ZIK

    1) Run it
    2) press F2
    3) leave the edit mode
    4) press add aspect button
    5) press F2 again. Now the

    WithAspect

    ItemEditTemplate should be used, but is is not. EditeItem,TemplateSelector is not called at all.
    and click demo.zip

    Thank you Tom



  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 15 Nov 2012 Link to this post

    Hi Tom,

    Let me get straight to your issue. It is caused because the RadTreeView control sets it's ItemEditTemplate before the PreviewEditStarted event is fired. So if you change the template on this event the control will not be aware of that change.

    However, in order to overcome this you have to override the OnKeyDown event of the RadTreeViewItem and listen when the F2 (this key triggers the edit mode of the RadTreeView by default) key is pressed. By doing this, you can implement the custom logic for changing the templates before you call the base method. We have implemented this approach in the attached project. Please take a look at it and see if it works for you.

    Keep in mind that this is considered as a bad practice and it may cause unexpected behavior.

    On a side note, on the GetSupport page you'll see a Contact Support Team button which you can use to send a support ticket.

    Kind regards,
    Pavel R. Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top