Copied to clipboard

Flag this post as spam?

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


  • Nab 15 posts 35 karma points
    Sep 28, 2012 @ 16:52
    Nab
    0

    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>

  • Nab 15 posts 35 karma points
    Sep 28, 2012 @ 16:55
    Nab
    0

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft