예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //var pageNavItems = BlogService.FillPages().Where(p => p.IsDeleted == false && !p.NavOrder.Equals(string.Empty)).OrderBy(x => x.NavOrder).ToList();
        //foreach (var ogNAv2 in BlogEngine.Core.Page.Pages.Where(p => p.NavOrder.Equals(string.Empty)).OrderBy(x => x.NavOrder))
        //{
        //    if (Request.Url.ToString().ToLower().Contains(ogNAv2.Id.ToString().Replace("{", "").Replace("}", "")))
        //    {
        //        orphanPage = "home-page";
        //    }
        //}


        if (NavHelper.Instance.IsOphanPage(Request))
        {
            orphanPage = "home-page";
        }

        Page.Header.DataBind();
        pageHeading = Page.Header.Title;
        pageHeading = NavHelper.Instance.GetRootLevelTitle(Page.Header.Title);

        if (!IsPostBack)
        {
            Repeater1.DataSource = new object[] { new Object(), new Object(), new Object() };
            Repeater1.DataBind();

            DataAccess da = new DataAccess();
            RecipeCategory.DataSource           = da.GetCategoryRecipeList();
            RecipeCategory.DataTextField        = "Name";
            RecipeCategory.DataValueField       = "Id";
            RecipeCategory.AppendDataBoundItems = true;
            RecipeCategory.DataBind();
        }
        //if (Security.IsAuthenticated)
        //{
        //    aLogin.InnerText = Resources.labels.logoff;
        //    aLogin.HRef = Utils.RelativeWebRoot + "Account/login.aspx?logoff";
        //}
        //else
        //{
        //    aLogin.HRef = Utils.RelativeWebRoot + "Account/login.aspx";
        //    aLogin.InnerText = Resources.labels.login;
        //}
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //var pageNavItems = BlogService.FillPages().Where(p => p.IsDeleted == false && !p.NavOrder.Equals(string.Empty)).OrderBy(x => x.NavOrder).ToList();
        //foreach (var ogNAv2 in BlogEngine.Core.Page.Pages.Where(p => p.NavOrder.Equals(string.Empty)).OrderBy(x => x.NavOrder))
        //{
        //    if (Request.Url.ToString().ToLower().Contains(ogNAv2.Id.ToString().Replace("{", "").Replace("}", "")))
        //    {
        //        orphanPage = "home-page";
        //    }
        //}


        if (NavHelper.Instance.IsOphanPage(Request))
        {
            orphanPage = "home-page";
        }

        Page.Header.DataBind();
        pageHeading = Page.Header.Title;
        pageHeading = NavHelper.Instance.GetRootLevelTitle(Page.Header.Title);

        if (!IsPostBack)
        {
            bool autoSearch = false;

            DataAccess da = new DataAccess();
            RecipeCategory.DataSource           = da.GetCategoryRecipeList();
            RecipeCategory.DataTextField        = "Name";
            RecipeCategory.DataValueField       = "Id";
            RecipeCategory.AppendDataBoundItems = true;
            RecipeCategory.DataBind();

            if (Request.QueryString["cat"] != null)
            {
                try
                {
                    autoSearch = true;
                    RecipeCategory.SelectedValue = Request.QueryString["cat"];
                }
                catch (Exception ex)
                { }
            }
            if (Request.QueryString["key"] != null)
            {
                autoSearch          = true;
                RecipeKeywords.Text = Request.QueryString["key"];
            }

            var m = ReadSearchModel();
            var x = SearchRecipies(m);


            if (autoSearch)
            {
                WriteSearchModel(x);
                Jumper.Text = @"<script>$(document).ready(function () { window.location.href = '#res'; });</script>";
            }
            else
            {
                resultsPanel.Visible = false;
                Jumper.Text          = @"<script></script>";
            }
        }
        else
        {
            resultsPanel.Visible = true;
            Jumper.Text          = @"<script>$(document).ready(function () { window.location.href = '#res'; });</script>";
        }
    }