This is a migrated thread and some comments may be shown as answers.

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

3 Answers 30 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
tomas
Top achievements
Rank 1
tomas asked on 08 Nov 2012, 08:18 PM
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

3 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 13 Nov 2012, 09:55 AM
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.

0
tomas
Top achievements
Rank 1
answered on 13 Nov 2012, 01:36 PM
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



0
Pavel R. Pavlov
Telerik team
answered on 15 Nov 2012, 03:35 PM
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.

Tags
TreeView
Asked by
tomas
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
tomas
Top achievements
Rank 1
Share this question
or