public override bool ShowObject(string settingsXml) { string template = "Registration.ascx"; if (WidgetHost.OutputTemplate != null) { if (!string.IsNullOrEmpty(WidgetHost.OutputTemplate.OutputTemplateControl)) { template = WidgetHost.OutputTemplate.OutputTemplateControl; } } Control control = this.LoadControl("~/UserControls/Templates/" + template); IMinimalControl minimal = control as IMinimalControl; control.ID = "Registration"; PnlCnt.Controls.Add(control); if (Request.IsAuthenticated && !UserDataContext.GetUserDataContext().IsAdmin) { //hide the widget Control wgt = WidgetHelper.GetWidgetHost(this, 0, 6); if (wgt != null) { wgt.Visible = false; return(false); } } return(minimal.HasContent); }
protected void Page_Load(object sender, EventArgs e) { try { if (Settings != null) { if (Settings.ContainsKey("Width")) { WidthImg = string.Format("{0}px", 325); WidthCnt = string.Format("{0}px", (int)Settings["Width"] - 325); } } if (DataObject is Business.DataObjectProduct) { dataObjectProduct = (Business.DataObjectProduct)DataObject; } else { dataObjectProduct = DataAccess.Business.DataObject.Load <Business.DataObjectProduct>(DataObject.ObjectID, null, false); } PrintOutput(); // Set widget title Control widgetControl = WidgetHelper.GetWidgetHost(this, 0, 5); ((Literal)widgetControl.FindControl("LitTitle")).Text = string.Format("<h1>{0}</h1>", dataObjectProduct.Title); if ((PageType)Settings["ParentPageType"] == PageType.Detail) { ((IWidgetPageMaster)Page.Master).BreadCrumb.RenderDetailPageBreadCrumbs(dataObjectProduct); } } catch { } }