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

Base constructor calling CreateChildElements method

2 Answers 92 Views
Panorama
This is a migrated thread and some comments may be shown as answers.
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Czeshirecat asked on 06 Jul 2016, 04:35 PM

Hi. This is my first encounter with the Telerik control set.

As I don't have a clue yet, I'm amending a code fragment I found online to create a custom RadTileElement for my needs.

I'm passing in a database record to a constructor. I've then overridden the CreateChildElements method to map out the grid and set the strings etc according to whatever's passed in. But I noticed, when stepping through the code, that CreateChildElements was being called before my parameterized constructor.

Am I correct in assuming that the base constructor is calling a virtual method?

If the child elements are created before my constructor gets it's turn to set up the control then is there a better way to handle this?

ty in advance

 

 

2 Answers, 1 is accepted

Sort by
0
Czeshirecat
Top achievements
Rank 2
Iron
Iron
answered on 07 Jul 2016, 07:58 AM

Sorry. Don't know how to delete posts.

I just moved the code out of the virtual function and called it from the constructor.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 07 Jul 2016, 09:57 AM
Hello Claire,

Thank you for writing. 

It is normal that the CreateChildElements method is called before the constructor. If you are passing a data object when creating the tile, the constructor is the appropriate place to synchronize the custom elements with the associated data object.

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
Panorama
Asked by
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Answers by
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or