Global 'Code behind type' setting for front end?

Posted by Community Admin on 04-Aug-2018 20:30

Global 'Code behind type' setting for front end?

All Replies

Posted by Community Admin on 22-Jun-2011 00:00

Hello,

Is there any way to globally specify the "Code behind type" to use for all of our frontend pages? We are able to successfully set this on a page-by-page basis, but maintenance is a bit of a challenge this way.

We searched through the Page settings in the Advanced Administration Settings section, but did not see any similar setting there.

Thank you for any insight!

Regards,
John

Posted by Community Admin on 22-Jun-2011 00:00

Hi John,

All Sitefinity pages are dynamically created and custom and user controls are your presentation layer. You can create a base class for your custom controls and inherit from it. Another option is a custom master page ( template) which has code behind where you add common logic.

Best wishes,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested 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 22-Jun-2011 00:00

Hey Ivan,

Wow - late night!

We tried the master page route, but were having difficulty accessing the properties there from our custom controls. We did not see how to add the equivalent of "MasterType" that would allow us to directly access our master page properties. I know we can try casting, but with multiple levels of master pages (nested) this was not ideal because we had to check Page.Master, and Page.Master.Master, etc.

In the Pages admin section, Title & Properties, it allows us to set a "Code behind type" for each page. This works well for us, and we were just wondering if there was any global way to set this value.

Thanks, again!

Regards,
John

Posted by Community Admin on 23-Jun-2011 00:00

Hello John,

Yes code behind for pages would work. All you need is a class that inherits from System.Web.UI.Page which allows you to inject logic overriding some of the base methods.

There is no configuration you can use to set default value, but you can add a helper text from the configuration.

You can add help text from the configuration

ContentView
  • Controls
    • FrontendPages
      • Views
        • FrontendPagesListView
        • FrontendPagesCreate  
          • Sections
            • AdvancedOptionsSection
              • Fields
                • CodeBehindType


Regards,
Ivan Dimitrov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested 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 23-Aug-2011 00:00

This is great information, but for some reason when I add the value to the Value field and hit save, it says it saved but it does not retain the value.

Posted by Community Admin on 26-Aug-2011 00:00

Hello John,

Please make sure that you modified FrontendPagesEdit config section as well.

Kind regards,
Ivan Dimitrov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Posted by Community Admin on 26-Aug-2011 00:00

I did both sections, the problem is when I go back into the config section I just modified the value is not retained even though it said it was saved. I checked to make sure that my config files were not read only (I have seen that before).

Posted by Community Admin on 01-Sep-2011 00:00

Hi John Tolar,

You can change the Example resource key which is used to show helper text below the input field of the custom code behind.

Kind regards,
Ivan Dimitrov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Posted by Community Admin on 12-Oct-2011 00:00

Hi Ivan,
I'd like to add a custom code behind to several pages of an existing site.  Can I code this using the Fluent API?

Thanks!
Devin

Posted by Community Admin on 12-Oct-2011 00:00

Hi Devin,

Yes, you can use the fluent or standard API calls.

Kind regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested 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 12-Oct-2011 00:00

Hi Ivan,
Can you please provide some sample code demonstrating how to do this?

Thanks!
Devin

Posted by Community Admin on 12-Oct-2011 00:00

Hello Devin,

You can see a sample here.

Kind regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested 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