Assuming I understand what you are getting at, you could try using a template ( master page ) to solve that problem. You would simply create the template and insert the corresponding life cycle events handlers in that. Otherwise, I don't believe you can put per page code without use of a Macro.
You can alter the Master Page file to reference a code behind, or simply add a <script runat="server"> </script> section to your page and add the code there.
The ASP.NET page lifecycle is still there. Although the URLs (created by content pages) are virtual; all requests are routed through the root "~/default.aspx".
As for code-behind in the MasterPage templates - sure why not? It does require adding an extra attribute to the declaration for either "CodeBehind" or "Inherits".
thank you ... i understood the the options of code behind in the masterpage ...
but as the page itself lyfe cyle you wrote:
The ASP.NET page lifecycle is still there. Although the URLs (created by content pages) are virtual; all requests are routed through the root "~/default.aspx".
i know the urls are virtual , and every pages routes through "~/default.aspx". so , can i add a code behide in this page????
and if so, this code behind (in "~/default.aspx") is common for all page.. is that correct ??
so in all options , the code behind is common for some pages (in "~/default.aspx" or in template )
You could add code behind for the "default.aspx" page ... if you do, I'll need to create a class that inherits from "umbraco.UmbracoDefault" - otherwise you'll bork your front-end completely! I'd advise against this too - reason being that when you come to do an upgrade, you don't want to overwrite any bespoke changes that you've made.
In all honesty, I don't really understand what your issue is with using a user-control/macro? Feels like you're trying to swim upstream, when it's much easier to go with the flow of the cms/framework.
hi... lifecycle question
hi ....
i got a question ... since .aspx file are not really exists .. so there is no page lyfecycle and no page.load etc..
how can i have some server code on page.load of a page ??
i dont want to use (as a macro ) a user control lifecycle ... or httpmodule is there any other option ???
hope i made myself clear ...
thanks
Assuming I understand what you are getting at, you could try using a template ( master page ) to solve that problem. You would simply create the template and insert the corresponding life cycle events handlers in that. Otherwise, I don't believe you can put per page code without use of a Macro.
ok... but how can i put some server code on the template ...
it is like masterpage with no code behind...
like this ...
<%@ Master Language="C#" MasterPageFile="~/masterpages/umbMaster.master" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderID="cp_content" runat="server">
<div id="content" class="frontPage">
<umbraco:Item runat="server" field="bodyText"/>
</div>
</asp:Content>
You can alter the Master Page file to reference a code behind, or simply add a <script runat="server"> </script> section to your page and add the code there.
Hi gilpt,
The ASP.NET page lifecycle is still there. Although the URLs (created by content pages) are virtual; all requests are routed through the root "~/default.aspx".
As for code-behind in the MasterPage templates - sure why not? It does require adding an extra attribute to the declaration for either "CodeBehind" or "Inherits".
... or you can add code inline, like so...
Cheers, Lee.
thank you ... i understood the the options of code behind in the masterpage ...
but as the page itself lyfe cyle you wrote:
The ASP.NET page lifecycle is still there. Although the URLs (created by content pages) are virtual; all requests are routed through the root "~/default.aspx".
i know the urls are virtual , and every pages routes through "~/default.aspx". so , can i add a code behide in this page????
and if so, this code behind (in "~/default.aspx") is common for all page.. is that correct ??
so in all options , the code behind is common for some pages (in "~/default.aspx" or in template )
is that correct ???
thanks a lot
You could add code behind for the "default.aspx" page ... if you do, I'll need to create a class that inherits from "umbraco.UmbracoDefault" - otherwise you'll bork your front-end completely! I'd advise against this too - reason being that when you come to do an upgrade, you don't want to overwrite any bespoke changes that you've made.
In all honesty, I don't really understand what your issue is with using a user-control/macro? Feels like you're trying to swim upstream, when it's much easier to go with the flow of the cms/framework.
Cheers, Lee.
is working on a reply...