Best way to extend content module and modify layout?

Posted by Community Admin on 03-Aug-2018 19:42

Best way to extend content module and modify layout?

All Replies

Posted by Community Admin on 10-Sep-2010 00:00

How would I go about extending the Content Block module and override it's Render method for the purpose of changing the layout?  I get errors every time I attempt it, adding it to the App_Code folder then trying to add it to the ContentToolBox.

Posted by Community Admin on 13-Sep-2010 00:00

Hi Preston,

What kind of errors are you getting?

Sitefinity 4.0 Beta is a web application. App_Code folder is not supported in web application projects. The App_Code folder is compiled at run time where as the web application requires pre-run compilation. Try creating a code library project, place your code there build into an assembly  and add it to the bin folder of your website. Or if you insist on using App_Code, you need to compile the application first.

Best wishes,
Radoslav Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 13-Sep-2010 00:00

I have attached screen shots to show what I am attempting to do.  The toolbox does show the custom content block, but then displays the error after I add it to the page. 

Posted by Community Admin on 13-Sep-2010 00:00

Hi Preston,

Thank you for getting back to me.

When overriding built in controls you have to override the template path so that it does not try to load it from the embedded resource (original template). This principle is the same as with Sitefinity 3.x controls. Attached is sample project.

Kind regards,
Radoslav Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 15-Sep-2010 00:00

Shouldn't I be able to override the template path via the configuration in the LayoutTemplate field?

LayoutTemplate
~/controls/CustomContentBlock.ascx
Specifies the name of an embedded layout template or the path to an external (.ascx) template.

rather than override it in the class?

Posted by Community Admin on 15-Sep-2010 00:00

Hello Preston,

ContentBlock control has a public property LayoutTemplatePath that you can set from its Advanced settings. There are some caching issues when you work with the configuration.
Of course overriding the property is an option.

Greetings,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed