Beispiel #1
0
        protected void GridView1_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ContentBlock b = (ContentBlock)e.Row.DataItem;

                bool controlFound = false;

                System.Web.UI.Control viewControl;

                // Control name gets spaces replaced for backwards compatibility
                viewControl = ModuleController.LoadContentBlockAdminView(b.ControlName.Replace(" ", ""), this.Page);
                if (viewControl == null)
                {
                    //No admin view, try standard view

                    // Block views are now MVC partial so we need a way to render them here
                    // There are some tricks but since this page will eventually go MVC itself
                    // we'll just put in placeholders for now.
                    //viewControl = ModuleController.LoadContentBlock(b.ControlName, this.Page);
                    viewControl = new BlankBlock()
                    {
                        bvin = b.Bvin, Text = "<div>Block: " + b.ControlName + "</div>"
                    };
                }


                if (viewControl != null)
                {
                    if ((viewControl is BVModule) || (viewControl is BlankBlock))
                    {
                        if (viewControl is BVModule)
                        {
                            ((BVModule)viewControl).BlockId = b.Bvin;
                        }
                        controlFound = true;
                        e.Row.Cells[0].Controls.Add(new System.Web.UI.LiteralControl("<div style=\"width:280px;overflow:auto;\">"));
                        e.Row.Cells[0].Controls.Add(viewControl);
                        e.Row.Cells[0].Controls.Add(new System.Web.UI.LiteralControl("</div>"));
                    }
                }

                if (controlFound == true)
                {
                    // Check for Editor
                    HyperLink lnkEdit = (HyperLink)e.Row.FindControl("lnkEdit");
                    if (lnkEdit != null)
                    {
                        lnkEdit.Visible = EditorExists(b.ControlName);
                    }
                }
                else
                {
                    e.Row.Cells[0].Controls.Add(new System.Web.UI.LiteralControl("Control " + b.ControlName + "could not be located"));
                }
            }
        }
        protected void GridView1_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ContentBlock b = (ContentBlock)e.Row.DataItem;

                bool controlFound = false;

                System.Web.UI.Control viewControl;

                // Control name gets spaces replaced for backwards compatibility
                viewControl = ModuleController.LoadContentBlockAdminView(b.ControlName.Replace(" ",""), this.Page);                
                if (viewControl == null)
                {
                    //No admin view, try standard view
                    
                    // Block views are now MVC partial so we need a way to render them here
                    // There are some tricks but since this page will eventually go MVC itself
                    // we'll just put in placeholders for now.
                    //viewControl = ModuleController.LoadContentBlock(b.ControlName, this.Page);
                    viewControl = new BlankBlock() { bvin= b.Bvin, Text= "<div>Block: " + b.ControlName + "</div>"};                    
                }


                if (viewControl != null)
                {
                    if ((viewControl is BVModule) || (viewControl is BlankBlock))
                    {
                        if (viewControl is BVModule)
                        {
                            ((BVModule)viewControl).BlockId = b.Bvin;
                        }
                        controlFound = true;
                        e.Row.Cells[0].Controls.Add(new System.Web.UI.LiteralControl("<div style=\"width:280px;overflow:auto;\">"));                        
                        e.Row.Cells[0].Controls.Add(viewControl);
                        e.Row.Cells[0].Controls.Add(new System.Web.UI.LiteralControl("</div>"));
                    }
                }

                if (controlFound == true)
                {
                    // Check for Editor
                    HyperLink lnkEdit = (HyperLink)e.Row.FindControl("lnkEdit");
                    if (lnkEdit != null)
                    {
                        lnkEdit.Visible = EditorExists(b.ControlName);
                    }
                }
                else
                {
                    e.Row.Cells[0].Controls.Add(new System.Web.UI.LiteralControl("Control " + b.ControlName + "could not be located"));
                }
            }
        }