Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Scott 69 posts 146 karma points
    Feb 22, 2012 @ 17:10
    Scott
    0

    Custom method in masterpage template.

    I dont know if this is an umbraco question or more of an asp.net question, but can you create a method/function inside of your master template? Between  my "asp:content" tags in my master template I currently have some top down c# code for setting/checking some session variables and that type of thing. In my content pages that will use my master template I was wanting to put in a check at the top of each page for a some things, but what its checking is different based on the content page. It would be easier if I could put the logic for that check into a common area, passing in a parameter of what I'm checking for, then just make a call to that method from my content pages. I thought putting a method in my master template might work but so far if I just try putting in a method code block, I get a compiler error when I access that page.

    I could probably accomplish this in a binary but its not really that much code, just 10 lines or so. But enough so that I dont want to have to duplicate it on each and every content page.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies