Portal Engine
Version 3.x > Portal Engine > 3.1a change to cloned web parts? View modes: 
User avatar
Member
Member
dave.diehl-asg - 9/8/2008 2:49:02 PM
   
3.1a change to cloned web parts?
I just want to confirm a change in behavior between 3.1 and 3.1a.

When I cloned a web part in 3.1, it basically created a new web part using all the new source from the old part.

3.1a now simply refers to the old part as a custom control in the aspx page and uses references to the custom control in codebehind...

this.MyWebPart1.OnContentLoaded();

If this not a surprise (which I'm assuming is the case...you guys are too good to for this to be an oversight), what is the new recommended procedure for customizing a shipped web part? E.g. the "Membership/My Profile" web part?

Dave


User avatar
Kentico Support
Kentico Support
kentico_jurajo - 9/9/2008 3:54:02 AM
   
RE:3.1a change to cloned web parts?
Hi Dave,

I have tried to clone mentioned web part in both version of Kentico CMS and the behavior is the same. The class name and code file name are changed as it is necessary. If you mean the "Register" tag for the control, this is needed to be ensured by the developer to change it and also to change the ID of the control. The important thing is that it inherits from different class.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
Dave Diehl - 9/9/2008 9:02:43 AM
   
RE:3.1a change to cloned web parts?
I guess what I'm saying is that that 3.1 cloned new web parts by copying code. 3.1a clones by inheritance. At least that's what MY copy of 3.1 did.

I discovered this when following the instruction on the faq "Adding custom fields into RegistrationForm web part". The instructions assume that you have access to the cloned web part's source so you can add the web controls and change the backend code. With inheritance...this isn't possible...or...not as obvious.

I can get around all this by simply copying and pasting your web part to a new one in VS.

I just wanted to find out if 1) this was a change in behavior you expected and, if so, 2) you need to update that FAQ.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 9/9/2008 9:40:21 AM
   
RE:3.1a change to cloned web parts?
Hi again,

It seems that we donot understand each other. The clone of the web part is recommended to avoid the changes by further upgrade (the default files are often overwritten by the new files).

When you clone the registration form web part you have the same functionality as the original one and you can add the code as you want to. Of course, you need to register the controls you want to use. The example shows how to add new fields and how to handle the values. I do not see any problems with the inheritance in this example.

Maybe better example is the MyProfile web part - there you need to change the register element manually since cloning the web parts means that the clone is the same as the original.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
Dave Diehl - 9/9/2008 10:02:34 AM
   
RE:3.1a change to cloned web parts?
I think you're right. :)

I talked with my co-hort here and it seems that the differences in how it deals with cloning (inherit vs copy) is not relative to the upgrade. It's based on something else.

So, my last question is...What determines how the CMS picks copying or inheritance?


User avatar
Kentico Support
Kentico Support
kentico_jurajo - 9/10/2008 5:06:44 AM
   
RE:3.1a change to cloned web parts?
Hi again,

the design of this is so that it only checks the first line and changes the class inheritance since the classes cannot be with the same name. All other lines are not touched.


Best Regards,
Juraj Ondrus