<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server"> <umbraco:Macro runat="server" Language="razor"> @{ var last = @Model.Children.LastOrDefault(); /*if (last != null){ Response.Redirect(last.Url); } else{ var landing = uBlogsy.BusinessLogic.DataService.Instance.GetLanding(Model.Id); Response.Redirect(landing.Url); }*/
var currentPage = @Model; var i = 0; var OverviewPage = currentPage.Children.Where("Name.ToLower() == @0", currentPage.Name.ToLower() + "Overview").FirstOrDefault(); if (OverviewPage != null) { //Response.Redirect(OverviewPage.Url); i = 1; } else { i = 2; } } </umbraco:Macro> </asp:Content>
The following however does not run by changing the if/else loop and removing ToLower(). Furthermore if I just want to use SingleOrDefault and pass the predicate as its parameter, it fails too!
<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server"> <umbraco:Macro runat="server" Language="razor"> @{ var last = @Model.Children.LastOrDefault(); /*if (last != null){ Response.Redirect(last.Url); } else{ var landing = uBlogsy.BusinessLogic.DataService.Instance.GetLanding(Model.Id); Response.Redirect(landing.Url); }*/
var currentPage = @Model; var i = 0; var OverviewPage = currentPage.Children.Where("Name == @0", currentPage.Name + "Overview").FirstOrDefault(); if (OverviewPage != null) { //Response.Redirect(OverviewPage.Url); i = 1; } else i = 2; } </umbraco:Macro> </asp:Content>
Strange behavior
Hi all
I am changing few things in ublogsy for my website. If I run the following, its fine:
<%@ Master Language="C#" MasterPageFile="~/masterpages/uBlogsyBase.master" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
<umbraco:Macro runat="server" Language="razor">
@{
var last = @Model.Children.LastOrDefault();
/*if (last != null){
Response.Redirect(last.Url);
}
else{
var landing = uBlogsy.BusinessLogic.DataService.Instance.GetLanding(Model.Id);
Response.Redirect(landing.Url);
}*/
var currentPage = @Model;
var i = 0;
var OverviewPage = currentPage.Children.Where("Name.ToLower() == @0", currentPage.Name.ToLower() + "Overview").FirstOrDefault();
if (OverviewPage != null)
{
//Response.Redirect(OverviewPage.Url);
i = 1;
}
else
{
i = 2;
}
}
</umbraco:Macro>
</asp:Content>
The following however does not run by changing the if/else loop and removing ToLower(). Furthermore if I just want to use SingleOrDefault and pass the predicate as its parameter, it fails too!
<%@ Master Language="C#" MasterPageFile="~/masterpages/uBlogsyBase.master" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
<umbraco:Macro runat="server" Language="razor">
@{
var last = @Model.Children.LastOrDefault();
/*if (last != null){
Response.Redirect(last.Url);
}
else{
var landing = uBlogsy.BusinessLogic.DataService.Instance.GetLanding(Model.Id);
Response.Redirect(landing.Url);
}*/
var currentPage = @Model;
var i = 0;
var OverviewPage = currentPage.Children.Where("Name == @0", currentPage.Name + "Overview").FirstOrDefault();
if (OverviewPage != null)
{
//Response.Redirect(OverviewPage.Url);
i = 1;
}
else
i = 2;
}
</umbraco:Macro>
</asp:Content>
Thanks
is working on a reply...