Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["pageId"] != null)
        {
            tblPageXControl pxc = new tblPageXControl();
            pxc.Where.PageId.Value = Int32.Parse(Request["pageId"]);

            pxc.Query.Load();

            pxc.Sort = "SortOrder";

            tblControlsXItems cxi = new tblControlsXItems();
            cxi.Where.ControlId.Value = pxc.ControlId;
            cxi.Query.Load();
            if (cxi.RowCount > 0)
            {
                Button1.Visible = true;
            }
            else{Button1.Visible = false;}
                if (pxc.RowCount > 0)
                {
                    pxc.Rewind();
                    do
                    {

                        // add this control's children
                        tblControls ctl = new tblControls();
                        ctl.Where.ParentControlId.Value = pxc.ControlId;
                        ctl.Query.Load();

                        ctl.Sort = "ParentControlSortOrder ASC";

                        addControl(pxc.ControlId);

                        if (ctl.RowCount > 0)
                        {
                            ctl.Rewind();
                            do
                            {
                                if ((pxc.ControlId != ctl.ParentControlId) && (ctl.Custom))
                                { addControl(ctl.ControlId); }
                            }

                            while (ctl.MoveNext());
                        }
                        else
                        {

                        }

                    } while (pxc.MoveNext());
                }
            }

        if (PlaceHolder1.Controls.Count == 0)
        {
            Button1.Visible = false;
        }
    }
Пример #2
0
    private void placeData()
    {
        tblLanguages lang = new tblLanguages();
        lang.Where.SiteId.Value = Int32.Parse(Request["siteId"]);
        lang.Query.Load();

        do
        {
            tblPagesXLanguage pxl = new tblPagesXLanguage();
            pxl.Where.LanguageId.Value = lang.LanguageId;
            pxl.Sort = "SortOrder ASC";

            pxl.Query.Load();

            do
            {
                tblPageXControl pxc = new tblPageXControl();
                pxc.Where.PageId.Value = pxl.PageId;

                pxc.Query.Load();

                pxc.Sort = "CmsSortOrder ASC";

                if (pxc.RowCount > 0)
                {
                    pxc.Rewind();
                    do
                    {
                        tblControls ctls = new tblControls();
                        ctls.LoadByPrimaryKey(pxc.ControlId);

                        HyperLink hl = new HyperLink();
                        hl.Text = ctls.ControlFriendlyName;

                        PlaceHolder1.Controls.Add(hl);
                    } while (pxc.MoveNext());
                }
            } while (pxl.MoveNext());
        } while (lang.MoveNext());
    }
Пример #3
0
    protected void Page_PreInit(object sender, EventArgs e)
    {
        if (Request["pg"] != null)
        {
            if (int.Parse(Request["pg"]) > -1)
            {
                // first, grab the pageID
                int page = Int32.Parse(Request["pg"]);

                // then site id
                int site = Int32.Parse(Request["siteId"]);

                tblPages pages = new tblPages();
                pages.Where.PageId.Value = page;

                pages.Query.Load();

                tblMasterPages master = new tblMasterPages();
                master.LoadByPrimaryKey(pages.MasterPageId);

                Page.MasterPageFile = "~/App_MasterPages/" + master.MasterPageTitle;

                // find the place holders
                tblContentPanes panes = new tblContentPanes();
                panes.Where.MasterPageId.Value = pages.MasterPageId;
                panes.Query.Load();

                do
                {
                    tblPageXControl pgx = new tblPageXControl();

                    pgx.Where.PageId.Value = page;
                    pgx.Where.ContentPaneId.Value = panes.ContentPaneId;

                    pgx.Query.Load();

                    if (pgx.RowCount > 0)
                    {
                        pgx.Rewind();
                        do
                        {
                            ContentPlaceHolder ph1 = (ContentPlaceHolder)Master.FindControl(panes.ContentPaneTitle);

                            tblControls control = new tblControls();
                            control.LoadByPrimaryKey(pgx.ControlId);
                           ph1.Controls.Add(Page.LoadControl("~/App_Controls/" + control.ControlLocation));
                        } while (pgx.MoveNext());
                    }
                } while (panes.MoveNext());

                tblSites ts = new tblSites();
                ts.LoadByPrimaryKey(site);
                tblPagesXLanguage pg = new tblPagesXLanguage();
                pg.Where.PageId.Value = page;
                pg.Where.LanguageId.Value = Convert.ToInt32(Request["langid"]);
                pg.Query.Load();

                Page.Title = ts.SiteTitle + " - " + pg.PageFriendlyName;
            }
        }
    }