private Control CreateApplicationLogo() { if (string.IsNullOrEmpty(m_MasterPageSettings.Header.LogoImageUrl)) { return(null); } HtmlGenericControl div = null; HtmlGenericControl ul = null; try { div = new HtmlGenericControl("div"); div.Attributes["class"] = "Al"; ul = new HtmlGenericControl("ul"); div.Controls.Add(ul); Control li = CreateApplicationLogoListItem(null); ul.Controls.Add(li); return(div); } finally { if (div != null) { div.Dispose(); } if (ul != null) { ul.Dispose(); } } }
private static Control CreateRadioButton(Setting setting, bool value, bool selectedValue) { HtmlGenericControl radioButton = null; HtmlGenericControl label = null; Control container = null; try { string str = setting.SettingId.ToString("N"); string controlId = string.Concat(ControlIdPrefix, str); str = string.Concat("ToggleOnOffSwitch('", str, "', ", (value ? "false" : "true"), ");"); radioButton = new HtmlGenericControl("input"); radioButton.Attributes["type"] = "radio"; radioButton.Attributes["onclick"] = str; radioButton.Attributes["name"] = controlId; str = controlId + (value ? "_0" : "_1"); radioButton.Attributes["id"] = str; radioButton.Attributes["value"] = (value ? "true" : "false"); if (selectedValue == value) { radioButton.Attributes["checked"] = "checked"; } label = new HtmlGenericControl("label"); label.Attributes["id"] = str + "_lbl"; label.Attributes["for"] = str; if (selectedValue == value) { label.Attributes["class"] = (value ? "On" : "Off"); } else { label.Attributes["class"] = "Rbl"; } label.InnerHtml = (value ? Resources.SettingsControl_OnOffSwitch_OnText : Resources.SettingsControl_OnOffSwitch_OffText) + " "; container = new Control(); container.Controls.Add(radioButton); container.Controls.Add(label); return(container); } finally { if (radioButton != null) { radioButton.Dispose(); } if (label != null) { label.Dispose(); } if (container != null) { container.Dispose(); } } }
public HttpResponseMessage GetMarkerEditForm(string filename, bool richtext = false) { string result = Common.GetResourceText(filename); StringBuilder sbFiles = new StringBuilder(); string folderPath = "/Umbraco/Images/MapPins/"; if (Directory.Exists(HttpContext.Current.Server.MapPath(folderPath))) { foreach (string file in Directory.GetFiles(HttpContext.Current.Server.MapPath(folderPath))) { using (StringWriter stringWriter = new StringWriter()) { using (HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter)) { HtmlGenericControl optionHtml = new HtmlGenericControl("option"); optionHtml.Attributes.Add("value", string.Concat(folderPath, Path.GetFileName(file))); optionHtml.InnerText = Path.GetFileName(file); optionHtml.RenderControl(htmlWriter); sbFiles.Append(stringWriter.ToString()); optionHtml.Dispose(); } } } } return(new HttpResponseMessage() { Content = new StringContent(string.Format(result, sbFiles.ToString(), richtext ? "richtext-fix" : string.Empty), System.Text.Encoding.UTF8, "application/html") }); }
public System.IO.MemoryStream formatData(System.Xml.XmlDocument rawData, System.Xml.XmlDocument xslt) { byte[] bPDF = null; try { MemoryStream ms = new MemoryStream(); System.Web.UI.HtmlControls.HtmlGenericControl gc = new HtmlGenericControl(); System.IO.MemoryStream inputStream = new System.IO.MemoryStream(); System.IO.MemoryStream outoputStream = new System.IO.MemoryStream(); string head = ""; string foot = ""; XslCompiledTransform xs = new XslCompiledTransform(); xs.Load(xslt); inputStream.Position = 0; rawData.Save(inputStream); inputStream.Position = 0; System.Xml.XmlTextReader xTextReader = new XmlTextReader(inputStream); xs.Transform(rawData, null, outoputStream); outoputStream.Seek(0, System.IO.SeekOrigin.Begin); System.IO.StreamReader streamReader = new System.IO.StreamReader(outoputStream); gc.TagName = "div"; string output = streamReader.ReadToEnd(); // Pulisco e compatto l'output string whattostrip = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<xsl:stylesheet version=\"2.0\" "; output = output.Replace(whattostrip, String.Empty); whattostrip = "<html xmlns=\"http://tempuri.org/DefinizioneResponse.xsd\">"; output = output.Replace(whattostrip, String.Empty); whattostrip = "dd/mm/yyyy"; output = output.Replace(whattostrip, System.DateTime.Now.ToString("dd/MM/yyyy")); gc.InnerHtml = head + output + foot; gc.Dispose(); streamReader.Close(); streamReader.Dispose(); StringReader txtReader = new StringReader(gc.InnerHtml); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); MemoryStream m = new MemoryStream(); System.Drawing.Image imageDisco = System.Drawing.Image.FromFile(ConfigurationManager.AppSettings["ImageRoma"]); iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(imageDisco, BaseColor.WHITE); image.ScaleToFit(336f, 86f); HTMLWorker htmlparser = new HTMLWorker(pdfDoc); PdfWriter.GetInstance(pdfDoc, ms); pdfDoc.Open(); pdfDoc.Add(image); htmlparser.Parse(txtReader); pdfDoc.Close(); bPDF = ms.ToArray(); } catch (Exception ex) { ErrorLogInfo error = new ErrorLogInfo(); error.freeTextDetails = ex.Message; error.logCode = "ERR_PDF_001"; } return(StreamUty.byteArray2MemoryStream(bPDF)); }
private static MvcHtmlString GoogleMap(HtmlHelper helper, string id, Models.Map map, bool editor) { StringBuilder sbControlHtml = new StringBuilder(); using (StringWriter stringWriter = new StringWriter()) { using (HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter)) { //Generate container div control HtmlGenericControl divWrapperControl = new HtmlGenericControl("div"); HtmlGenericControl divMapControl = new HtmlGenericControl("div"); divMapControl.Attributes.Add("class", "map-container"); divMapControl.Attributes.Add("id", string.Format("map-{0}", id)); if (map.height > 0 || map.width > 0) { string widthStyle = "width:{0}px;"; if (map.width > 0) { widthStyle = string.Format(widthStyle, map.width); } else { widthStyle = string.Empty; } string heightStyle = "height:{0}px;"; if (map.height > 0) { heightStyle = string.Format(heightStyle, map.height); } else { heightStyle = string.Empty; } divMapControl.Attributes.Add("style", string.Concat(widthStyle, heightStyle)); } divWrapperControl.Controls.Add(divMapControl); //value input control HtmlInputHidden hidden = new HtmlInputHidden(); HtmlInputHidden hiddenValueControl = new HtmlInputHidden(); hiddenValueControl.ID = id; divWrapperControl.Controls.Add(hiddenValueControl); HtmlGenericControl scriptControl = new HtmlGenericControl("script"); scriptControl.Attributes.Add("type", "text/javascript"); scriptControl.InnerHtml = string.Format(@"$(document).ready(function(){{ $('#map-{0}').GoogleMapEditor($.extend({{}},{1},{{dataChange:function(sender, data){{ $(sender.container).next().next().val(data); }}}}));}});", id, map.ToJsonString()); divWrapperControl.Controls.Add(scriptControl); divWrapperControl.RenderControl(htmlWriter); sbControlHtml.Append(stringWriter.ToString()); divWrapperControl.Dispose(); } } return(new MvcHtmlString(sbControlHtml.ToString())); }
private static Control CreateDropDownList(Setting setting, bool diagnoseConflictingSettings) { HtmlGenericControl ctl = null; HtmlGenericControl select = null; try { string valueStr = setting.Value; string currentValue = null; select = new HtmlGenericControl("select"); if (setting.IsConflicting) { ctl = new HtmlGenericControl("option"); ctl.InnerHtml = Resources.SettingsControl_SettingValueUndefined; select.Controls.Add(ctl); } else { select.Attributes["id"] = select.Attributes["name"] = string.Concat(ControlIdPrefix, setting.SettingId.ToString("N")); foreach (DataRow row in SettingProvider.GetSettingListValues(setting.SettingId).Rows) { currentValue = row["Value"].ToString(); ctl = new HtmlGenericControl("option"); ctl.Attributes["value"] = currentValue; if (string.Compare(currentValue, valueStr, StringComparison.CurrentCulture) == 0) { ctl.Attributes["selected"] = "selected"; } ctl.InnerHtml = row["Name"].ToString(); select.Controls.Add(ctl); } } if (diagnoseConflictingSettings) { select.Disabled = true; select.Style.Add(HtmlTextWriterStyle.Color, "Gray"); } return(select); } finally { if (select != null) { select.Dispose(); } if (ctl != null) { ctl.Dispose(); } } }
protected void Page_Init(object sender, EventArgs e) { AlphaSelection1.CK += new WebControls_AlphaSelection.EventHandler(AlphaSelection1_CK); HtmlGenericControl link = new HtmlGenericControl("LINK"); link.Attributes.Add("rel", "stylesheet"); link.Attributes.Add("type", "text/css"); link.Attributes.Add("href", "../" + Session["CSSChange"].ToString()); Controls.Add(link); link.Dispose(); }
private HtmlGenericControl CreateSimpleItem(Micajah.Common.Bll.Action item, bool rootAndGroup) { HtmlGenericControl div = null; Label lbl = null; try { div = new HtmlGenericControl("div"); if (rootAndGroup) { lbl = new Label(); lbl.Text = item.CustomName; div.Controls.Add(lbl); } else { div.Controls.Add(CreateItemLink(item)); } if ((!item.GroupInDetailMenu) && item.ShowDescriptionInDetailMenu && (this.Theme != DetailMenuTheme.Decorated)) { string descr = item.CustomDescription; if (!string.IsNullOrEmpty(descr)) { div.Controls.Add(CreateItemDescription(descr)); } } Control ctrl = CreateChildItems(item); if (ctrl != null) { div.Controls.Add(ctrl); } return(div); } finally { if (div != null) { div.Dispose(); } if (lbl != null) { lbl.Dispose(); } } }
private Control CreateChildItems(Micajah.Common.Bll.Action item) { HtmlGenericControl div = null; if (item.ShowChildrenInDetailMenu) { ActionCollection availableChildActions = item.GetAvailableChildActions(m_ActionIdList, m_IsFrameworkAdmin, m_IsAuthenticated); if (availableChildActions.Count > 0) { ControlList list = null; try { div = new HtmlGenericControl("div"); div.Attributes["class"] = "C"; list = new ControlList(); list.Delimiter = ", "; foreach (Micajah.Common.Bll.Action childItem in availableChildActions) { if (list.Count < MaxChildItems) { list.Add(CreateItemLink(childItem)); } else { list.Add(CreateItemLink(item, Resources.DetailMenu_Ellipsis, false)); break; } } div.Controls.Add(list); } finally { if (div != null) { div.Dispose(); } if (list != null) { list.Dispose(); } } } } return(div); }
private void PopulateSiteListControl(List <WebListItem> webList) { HyperLink hl = null; HtmlGenericControl li = null; HtmlGenericControl ul = new HtmlGenericControl("ul"); try { foreach (WebListItem webListItem in webList) { li = new HtmlGenericControl("li"); li.Attributes.Add("title", PageCulture.Format(PageCulture.Resources.ActionsMRUToolTip, Server.HtmlEncode(webListItem.Title))); hl = new HyperLink(); hl.NavigateUrl = AssignmentSiteUrl(webListItem.Url); hl.Text = Server.HtmlEncode(webListItem.Title); li.Controls.Add(hl); hl = null; if (newSite.HasValue && newSite.Value.Equals(webListItem.SPWebGuid)) { HtmlImage img = new HtmlImage(); img.Src = "Images/NewIcon.gif"; li.Controls.Add(img); } ul.Controls.Add(li); li = null; } siteList.Controls.Add(ul); ul = null; } catch { if (hl != null) { hl.Dispose(); } if (li != null) { li.Dispose(); } if (ul != null) { ul.Dispose(); } throw; } }
protected void Page_Init(object sender, EventArgs e) { /* * HtmlLink css = new HtmlLink(); * css.Href = "~/Brown.css"; * css.Attributes["rel"] = "stylesheet"; * css.Attributes["type"] = "text/css"; * css.Attributes["media"] = "all"; * Page.Controls.Add(css); */ HtmlGenericControl link = new HtmlGenericControl("LINK"); link.Attributes.Add("rel", "stylesheet"); link.Attributes.Add("type", "text/css"); link.Attributes.Add("href", "../" + Session["CSSChange"].ToString()); Controls.Add(link); link.Dispose(); }
public void Clenaup() { shimsContext?.Dispose(); cbxAllowMultiValue?.Dispose(); cbxUnlimitedLengthInDocLib?.Dispose(); cbxRecursiveFilter?.Dispose(); txtQueryFilter?.Dispose(); lblTargetList?.Dispose(); lblTargetWeb?.Dispose(); listTargetList?.Dispose(); listTargetWeb?.Dispose(); listTargetListView?.Dispose(); tdListView?.Dispose(); tdQuery?.Dispose(); rdFilterOption?.Dispose(); SpanDocLibWarning?.Dispose(); SpanLengthWarning?.Dispose(); listTargetColumn?.Dispose(); }
private void CreateChildControlsStandard() { HtmlGenericControl container = null; Control ctrl = null; try { container = new HtmlGenericControl("div"); ctrl = this.CreateLogo(); if (ctrl != null) { container.Controls.Add(ctrl); } ctrl = this.CreateHeaderLinks(); if (ctrl != null) { container.Controls.Add(ctrl); } if (container.HasControls()) { container.Attributes["class"] = "Mp_Hdr"; this.Controls.Add(container); } } finally { if (container != null) { container.Dispose(); } if (ctrl != null) { ctrl.Dispose(); } } }
private Control CreateApplicationLogoListItem(string cssClass) { if (string.IsNullOrEmpty(m_MasterPageSettings.Header.LogoImageUrl)) { return(null); } HtmlGenericControl li = null; HyperLink link = null; try { li = new HtmlGenericControl("li"); if (!string.IsNullOrEmpty(cssClass)) { li.Attributes["class"] = cssClass; } link = new HyperLink(); link.ImageUrl = m_MasterPageSettings.Header.LogoImageUrl; link.NavigateUrl = m_MasterPage.HeaderLogoNavigateUrl; li.Controls.Add(link); return(li); } finally { if (li != null) { li.Dispose(); } if (link != null) { link.Dispose(); } } }
/// <summary> /// Creates child controls. /// </summary> protected override void CreateChildControls() { this.Controls.Clear(); HtmlGenericControl footerDiv = null; HtmlGenericControl leftDiv = null; HtmlGenericControl copyrightDiv = null; try { copyrightDiv = new HtmlGenericControl("div"); footerDiv = new HtmlGenericControl("div"); WebApplicationElement webAppSettings = FrameworkConfiguration.Current.WebApplication; if (m_UserContext != null) { leftDiv = new HtmlGenericControl("div"); StringBuilder sb = new StringBuilder(); if (m_UserContext.OrganizationId != Guid.Empty) { sb.Append(m_UserContext.Organization.Name); } if (webAppSettings.EnableMultipleInstances && (m_UserContext.InstanceId != Guid.Empty)) { if (sb.Length > 0) { sb.Append("<br />"); } sb.Append(m_UserContext.Instance.Name); } string roleName = RoleProvider.GetRoleName(m_UserContext.RoleId); if (!string.IsNullOrEmpty(roleName)) { if (sb.Length > 0) { sb.Append("<br />"); } sb.Append(roleName); } leftDiv.Attributes["class"] = "L"; leftDiv.InnerHtml = sb.ToString(); } copyrightDiv.InnerHtml = string.Format(CultureInfo.InvariantCulture, Resources.Footer_CopyrightInformationFormatString, DateTime.UtcNow.Year, GetCompanyName(webAppSettings.Copyright)); if (webAppSettings.MasterPage.Footer.VisibleEngineeredBy) { copyrightDiv.InnerHtml += "<br />" + string.Format(CultureInfo.InvariantCulture, Resources.Footer_EngineeredByFormatString, BaseControl.GetHyperlink("http://www.micajah.com", Resources.Footer_MicajahCompanyName)); } if (leftDiv != null) { footerDiv.Controls.Add(leftDiv); } footerDiv.Controls.Add(copyrightDiv); footerDiv.Attributes["class"] = "Mp_Ftr"; this.Controls.Add(footerDiv); } finally { if (leftDiv != null) { leftDiv.Dispose(); } if (copyrightDiv != null) { copyrightDiv.Dispose(); } if (footerDiv != null) { footerDiv.Dispose(); } } }
/// <summary> /// Creates child controls. /// </summary> protected override void CreateChildControls() { this.Controls.Clear(); if (this.Items.Count == 0) { return; } HtmlGenericControl mainContainer = null; HtmlGenericControl container = null; HtmlGenericControl innerContainer = null; HtmlGenericControl bar = null; HtmlGenericControl ul = null; HtmlGenericControl p = null; ControlList controlList = null; Control itemLink = null; Guid mainMenuItemId = this.SelectedActionId; try { mainContainer = new HtmlGenericControl("div"); mainContainer.Attributes["class"] = "Mp_Mm"; this.Controls.Add(mainContainer); MasterPageTheme theme = FrameworkConfiguration.Current.WebApplication.MasterPage.Theme; switch (theme) { case MasterPageTheme.Gradient: case MasterPageTheme.StandardTabs: case MasterPageTheme.Modern: ul = new HtmlGenericControl("ul"); string cssClass = null; if (theme == MasterPageTheme.Modern) { p = new HtmlGenericControl("p"); p.Attributes["class"] = "mobile-nav"; p.InnerHtml = Resources.MainMenu_MenuLink_Text; innerContainer = new HtmlGenericControl("div"); innerContainer.Attributes["class"] = "col-sm-12"; innerContainer.Controls.Add(p); innerContainer.Controls.Add(ul); container = new HtmlGenericControl("div"); container.Attributes["class"] = "container"; container.Controls.Add(innerContainer); mainContainer.Controls.Add(container); cssClass = "active"; } else { mainContainer.Controls.Add(ul); cssClass = "S"; } foreach (Micajah.Common.Bll.Action item in this.Items) { if (item.ActionId == ActionProvider.StartPageActionId) { bool redirect = false; Micajah.Common.WebControls.AdminControls.StartControl.GetStartMenuCheckedItems(m_UserContext, out redirect); if (redirect) { continue; } } ul.Controls.Add(CreateLinkAsListItem(item, ((item.ActionId == mainMenuItemId) ? cssClass : null))); } if (theme != MasterPageTheme.Modern) { bar = new HtmlGenericControl("div"); bar.Attributes["class"] = "Mp_Mmb"; this.Controls.Add(bar); } break; case MasterPageTheme.Standard: controlList = new ControlList(); controlList.Delimiter = " | "; foreach (Micajah.Common.Bll.Action item in this.Items) { if (item.ActionId == ActionProvider.StartPageActionId) { bool redirect = false; Micajah.Common.WebControls.AdminControls.StartControl.GetStartMenuCheckedItems(m_UserContext, out redirect); if (redirect) { continue; } } itemLink = Submenu.CreateLink(item, ((item.ActionId == mainMenuItemId) ? "S" : null), false); controlList.Add(itemLink); } mainContainer.Controls.Add(controlList); break; } } finally { if (ul != null) { ul.Dispose(); } if (mainContainer != null) { mainContainer.Dispose(); } if (bar != null) { bar.Dispose(); } if (container != null) { container.Dispose(); } if (innerContainer != null) { innerContainer.Dispose(); } if (p != null) { p.Dispose(); } if (controlList != null) { controlList.Dispose(); } if (itemLink != null) { itemLink.Dispose(); } } }
/// <summary> /// Creates child controls. /// </summary> protected override void CreateChildControls() { this.Controls.Clear(); HtmlGenericControl htmlContainer = null; try { m_MainContainer = new HtmlGenericControl("div"); switch (m_Position) { case SubmenuPosition.Left: int width = FrameworkConfiguration.Current.WebApplication.MasterPage.LeftArea.Width; int decrement = m_ModernTheme ? 40 : 8; if (width > decrement) { width -= decrement; } m_MainContainer.Style[HtmlTextWriterStyle.Width] = width.ToString(CultureInfo.InvariantCulture) + "px"; m_MainContainer.Attributes["class"] = "Mp_L"; if ((this.Items != null) && (m_Items.Count > 0)) { this.CreateLeftSubmenu(); } if (m_MainContainer.HasControls()) { if (!string.IsNullOrEmpty(FrameworkConfiguration.Current.WebApplication.MasterPage.LeftArea.Html)) { m_MainContainer.Controls.Add(new LiteralControl("<br /><br />")); htmlContainer = new HtmlGenericControl("div"); htmlContainer.Attributes["class"] = "Mp_Lah"; htmlContainer.InnerHtml = FrameworkConfiguration.Current.WebApplication.MasterPage.LeftArea.Html; m_MainContainer.Controls.Add(htmlContainer); } } break; case SubmenuPosition.Top: if ((this.Items != null) && (m_Items.Count > 0)) { this.CreateTopSubmenu(); } break; } if (m_MainContainer.HasControls()) { this.Controls.Add(m_MainContainer); } } finally { if (htmlContainer != null) { htmlContainer.Dispose(); } if (m_MainContainer != null) { m_MainContainer.Dispose(); } } }
private Control CreateLogo() { if ((!m_MasterPage.VisibleHeaderLogo) || string.IsNullOrEmpty(m_MasterPageSettings.Header.LogoImageUrl)) { return(null); } string text = m_MasterPage.HeaderLogoText; string imageUrl = null; if (!m_ModernTheme) { imageUrl = m_MasterPage.HeaderLogoImageUrl; } if (string.IsNullOrEmpty(imageUrl) && string.IsNullOrEmpty(text)) { return(null); } HtmlGenericControl logoContainer = null; HyperLink link = null; Image image = null; try { string navigateUrl = m_MasterPage.HeaderLogoNavigateUrl; logoContainer = new HtmlGenericControl("div"); logoContainer.Attributes["class"] = "A"; if (!string.IsNullOrEmpty(imageUrl)) { if (!string.IsNullOrEmpty(navigateUrl)) { link = new HyperLink(); if (!string.IsNullOrEmpty(m_MasterPage.HeaderLogoTarget)) { link.Target = m_MasterPage.HeaderLogoTarget; } link.NavigateUrl = navigateUrl; link.ImageUrl = imageUrl; link.ToolTip = text; logoContainer.Controls.Add(link); } else { image = new Image(); image.ImageAlign = ImageAlign.AbsMiddle; image.ImageUrl = imageUrl; image.ToolTip = text; logoContainer.Controls.Add(image); } } else { if (!string.IsNullOrEmpty(navigateUrl)) { link = new HyperLink(); if (!string.IsNullOrEmpty(m_MasterPage.HeaderLogoTarget)) { link.Target = m_MasterPage.HeaderLogoTarget; } link.NavigateUrl = navigateUrl; link.ToolTip = text; link.Text = text; logoContainer.Controls.Add(link); } else { logoContainer.InnerHtml = text; } } return(logoContainer); } finally { if (logoContainer != null) { logoContainer.Dispose(); } if (link != null) { link.Dispose(); } if (image != null) { image.Dispose(); } } }
private Control CreateSearchControl(string paddindTop) { HtmlGenericControl div = null; System.Web.UI.WebControls.TextBox txt = null; try { div = new HtmlGenericControl("div"); string searchButtonOnClientClick = string.Format(CultureInfo.InvariantCulture , "if (Mp_Search('{0}{1}{2}')) {3}; return false;" , m_MasterPage.ClientID, this.ClientIDSeparator, SearchTextBoxId , this.Page.ClientScript.GetPostBackEventReference(new PostBackOptions(m_MasterPage, SearchButtonId, string.Empty, false, false, false, true, false, "Mp_Search"))); txt = new System.Web.UI.WebControls.TextBox(); txt.ID = SearchTextBoxId; txt.Style[HtmlTextWriterStyle.VerticalAlign] = "middle"; txt.CausesValidation = false; txt.ValidationGroup = "Mp_Search"; txt.Attributes["onkeypress"] = "if (event.keyCode == 13) {" + searchButtonOnClientClick + "}"; if (m_MasterPage.SearchTextBoxMaxLength > 0) { txt.MaxLength = m_MasterPage.SearchTextBoxMaxLength; } if (m_ModernTheme) { txt.CssClass = "form-control"; txt.Attributes["placeholder"] = HttpUtility.HtmlAttributeEncode(m_MasterPage.SearchTextBoxEmptyText); string searchText = m_MasterPage.SearchText; if (searchText != null) { txt.Text = searchText; } div.Attributes["class"] = "S"; } else { txt.Columns = m_MasterPage.SearchTextBoxColumns; txt.Attributes["onfocus"] = "Mp_SearchTextBox_OnFocus(this);"; txt.Attributes["onblur"] = "Mp_SearchTextBox_OnBlur(this);"; txt.Attributes["EmptyText"] = HttpUtility.HtmlAttributeEncode(m_MasterPage.SearchTextBoxEmptyText); string searchText = m_MasterPage.SearchText; if (searchText == null) { txt.Text = HttpUtility.HtmlAttributeEncode(m_MasterPage.SearchTextBoxEmptyText); txt.Style[HtmlTextWriterStyle.Color] = "Gray"; } else { txt.Text = searchText; txt.Style[HtmlTextWriterStyle.Color] = "Black"; } div.Style["clear"] = "both"; div.Style[HtmlTextWriterStyle.WhiteSpace] = "nowrap"; if (!string.IsNullOrEmpty(paddindTop)) { div.Style[HtmlTextWriterStyle.PaddingTop] = paddindTop; } } div.Controls.Add(txt); div.Controls.Add(new LiteralControl(" ")); return(div); } finally { if (div != null) { div.Dispose(); } if (txt != null) { txt.Dispose(); } } }
private Control CreateHeaderLinks() { if (!(m_MasterPage.VisibleHeaderLinks || m_MasterPage.VisibleSearchControl)) { return(null); } HtmlGenericControl rightContainer = null; Control links = null; HyperLink link = null; HtmlGenericControl div = null; HtmlGenericControl li = null; try { rightContainer = new HtmlGenericControl("div"); if (m_MasterPage.VisibleHeaderLinks) { links = CreateGlobalNavigation(this.Page.Request.IsSecureConnection); } if (m_ModernTheme) { rightContainer.Controls.Add(links); } else { rightContainer.Attributes["class"] = "G"; string paddindTop = null; if (links != null) { div = new HtmlGenericControl("div"); div.Style["clear"] = "both"; div.Controls.Add(links); rightContainer.Controls.Add(div); paddindTop = "8px"; } if (m_MasterPage.VisibleSearchControl) { rightContainer.Controls.Add(CreateSearchControl(paddindTop)); } } return(rightContainer); } finally { if (rightContainer != null) { rightContainer.Dispose(); } if (links != null) { links.Dispose(); } if (div != null) { div.Dispose(); } if (link != null) { link.Dispose(); } if (li != null) { li.Dispose(); } } }
private List <HtmlGenericControl> CreateDetailMenuItems(ActionCollection items, bool root) { List <HtmlGenericControl> list = new List <HtmlGenericControl>(); HtmlGenericControl li = null; HtmlGenericControl p = null; HtmlGenericControl span = null; try { foreach (Micajah.Common.Bll.Action action in items) { li = new HtmlGenericControl("li"); list.Add(li); if (root && action.GroupInDetailMenu) { li.Attributes["class"] = "G"; using (HtmlGenericControl h = new HtmlGenericControl("h1")) { h.InnerHtml = action.CustomName; li.Controls.Add(h); } } else { using (HtmlGenericControl h = new HtmlGenericControl("h2")) { h.InnerHtml = action.CustomName; li.Controls.Add(this.CreateItemLink(action, null, false, h, false)); } } if (root && action.GroupInDetailMenu) { list.AddRange(this.CreateDetailMenuItems(action.GetAvailableChildActions(m_ActionIdList, m_IsFrameworkAdmin, m_IsAuthenticated), false)); } if (!string.IsNullOrEmpty(action.VideoUrl)) { span = new HtmlGenericControl("span"); li.Controls.Add(span); using (HyperLink link = new HyperLink()) { link.NavigateUrl = action.VideoUrl; link.Target = "_blank"; link.Text = Resources.DetailMenu_VideoLink_Text; span.Controls.Add(link); } } if (!string.IsNullOrEmpty(action.LearnMoreUrl)) { span = new HtmlGenericControl("span"); li.Controls.Add(span); using (HyperLink link = new HyperLink()) { link.NavigateUrl = action.LearnMoreUrl; link.Target = "_blank"; link.Text = Resources.DetailMenu_LearnMoreLink_Text; span.Controls.Add(link); } } string customDescription = action.CustomDescription; if (!string.IsNullOrEmpty(customDescription)) { p = new HtmlGenericControl("p"); p.InnerHtml = customDescription; li.Controls.Add(p); } if (this.ItemDataBound != null) { this.ItemDataBound(li, new CommandEventArgs("ItemDataBound", action)); } } } finally { if (li != null) { li.Dispose(); } if (p != null) { p.Dispose(); } if (span != null) { span.Dispose(); } } return(list); }
private void CreateChildControlsModern() { HtmlGenericControl mainContainer = null; HtmlGenericControl container = null; HtmlGenericControl leftContainer = null; Control ctrl = null; try { container = new HtmlGenericControl("div"); leftContainer = new HtmlGenericControl("div"); ctrl = this.CreateApplicationLogo(); if (ctrl != null) { leftContainer.Controls.Add(ctrl); } ctrl = this.CreateLogo(); if (ctrl != null) { leftContainer.Controls.Add(ctrl); } if (m_MasterPage.VisibleSearchControl) { ctrl = CreateSearchControl(null); leftContainer.Controls.Add(ctrl); } if (leftContainer.HasControls()) { container.Controls.Add(leftContainer); } ctrl = this.CreateHeaderLinks(); if (ctrl != null) { container.Controls.Add(ctrl); } if (container.HasControls()) { container.Attributes["class"] = "container"; mainContainer = new HtmlGenericControl("div"); mainContainer.Attributes["class"] = "Mp_Hdr"; mainContainer.Controls.Add(container); this.Controls.Add(mainContainer); } } finally { if (mainContainer != null) { mainContainer.Dispose(); } if (container != null) { container.Dispose(); } if (leftContainer != null) { leftContainer.Dispose(); } if (ctrl != null) { ctrl.Dispose(); } } }
protected void Page_Load(object sender, EventArgs e) { // Note: This page is used to link to all samples contained in the solution // Generate links and descriptions for the samples foreach (string dir in Directory.GetDirectories(String.Format("{0}..", Server.MapPath("/")))) { string name = new DirectoryInfo(dir).Name; if (name == "MyLibrary" || name == "Home") { continue; } HyperLink link = null; HtmlGenericControl p = null; try { link = new HyperLink(); link.Text = name; XmlDocument projxml = new XmlDocument(); projxml.Load(String.Format(@"{0}\{1}.csproj", dir, name)); link.NavigateUrl = String.Format("http://localhost:{0}", projxml.GetElementsByTagName("DevelopmentServerPort")[0].InnerText); PlaceholderLinks.Controls.Add(link); string description = String.Empty; switch (name) { case "AjaxControls": description = "AJAX Sample: Demonstrates how to use the ReportViewer control with other AJAX controls. This sample requires the AdventureWorks 2008 Sample Reports."; break; case "CredentialsNoSession": description = "Demonstrates how to prevent the report server connection information from being stored in the ASP.NET session. This sample requires the AdventureWorks 2008 Sample Reports."; break; case "CustomAssembly": description = "Demonstrates how to use custom assemblies with your RDLC report."; break; case "CustomSkin": description = "Demonstrates how to change the skin of the ReportViewer control. This sample requires the AdventureWorks 2008 Sample Reports."; break; case "CustomStrings": description = "Demonstrates how to use custom UI strings in the ReportViewer control. This sample requires the AdventureWorks 2008 Sample Reports."; break; case "CustomToolBar": description = "AJAX Sample: Demonstrates how to use the client-side APIs to implement a custom toolbar for the ReportViewer control. This sample requires the AdventureWorks 2008 Sample Reports."; break; case "MapAndPrompt": description = "AJAX Sample: Demonstrates how to change the collapsed state of the document map and parameter prompt area without causing a postback. This sample requires the AdventureWorks 2008 Sample Reports."; break; case "PopupDrillthrough": description = "AJAX Sample: Demonstrates how to cause a ReportViewer control to open an AJAX popup when a drillthrough report is clicked. This sample requires the AdventureWorks 2008 Sample Reports."; break; case "RenderingAndPostBack": description = "Demonstrates the rendering and postback behaviors of the ReportViewer control. This sample requires the AdventureWorks 2008 Sample Reports."; break; case "ReportFromStream": description = "Demonstrates how to load an RDLC report from a stream."; break; case "ResettingScrollPosition": description = "AJAX Sample: Demonstrates how to programmatically set the report area scroll position without causing a postback. This sample requires the AdventureWorks 2008 Sample Reports."; break; case "ResizingViewer": description = "AJAX Sample: Demonstrates how to recalculate the ReportViewer layout when its container changes size. This sample requires the AdventureWorks 2008 Sample Reports."; break; case "SupplyingData": description = "Demonstrates how to supply data to an RDLC report, as well as any subreport or drillthrough report. It also demonstrates how to change the RDLC report at run time."; break; case "SupplyingParameters": description = "Demonstrates how to supply parameters to a server report. This sample requires the AdventureWorks 2008 Sample Reports."; break; default: break; } p = new HtmlGenericControl("p"); p.InnerText = description; PlaceholderLinks.Controls.Add(p); } finally { link.Dispose(); p.Dispose(); } } }
private void CreateLeftSubmenu() { HtmlGenericControl ulMain = null; HtmlGenericControl liMain = null; HtmlGenericControl ulSub = null; HtmlGenericControl liSub = null; Label lbl = null; try { string secondLevelItemCssClass = null; ulMain = new HtmlGenericControl("ul"); ulMain.Attributes["class"] = "Mp_Sm"; m_MainContainer.Controls.Add(ulMain); if (!m_ModernTheme) { secondLevelItemCssClass = "S"; } bool first = true; foreach (Action item in this.Items) { liMain = new HtmlGenericControl("li"); if (m_ModernTheme) { liMain.Attributes["class"] = "F"; if (first) { liMain.Attributes["class"] += " Fst"; first = false; } } else if (!((item.SubmenuItemHorizontalAlign == HorizontalAlign.NotSet) || (item.SubmenuItemHorizontalAlign == HorizontalAlign.Left))) { liMain.Style[HtmlTextWriterStyle.TextAlign] = item.SubmenuItemHorizontalAlign.ToString().ToLowerInvariant(); } if (item.GroupInDetailMenu) { lbl = new Label(); if (!m_ModernTheme) { lbl.CssClass = "F"; } lbl.Text = item.CustomName; liMain.Controls.Add(lbl); } else { liMain.Controls.Add(CreateLink(item, (m_ModernTheme ? null : "F"), m_ModernTheme)); } ulMain.Controls.Add(liMain); if (item.IsDetailMenuPage) { ActionCollection availableChildActions = item.GetAvailableChildActions(m_ActionIdList, m_IsFrameworkAdmin, m_IsAuthenticated); if (availableChildActions.Count > 0) { if (!m_ModernTheme) { ulSub = new HtmlGenericControl("ul"); } foreach (Action item2 in availableChildActions) { liSub = new HtmlGenericControl("li"); string cssClass = secondLevelItemCssClass; if (item2.HighlightInSubmenu) { if (!string.IsNullOrEmpty(cssClass)) { cssClass += " "; } cssClass += "H"; } if (item2.ActionId == this.SelectedItemId) { if (!string.IsNullOrEmpty(cssClass)) { cssClass += " "; } cssClass += "S"; } if (!string.IsNullOrEmpty(cssClass)) { liSub.Attributes["class"] = cssClass; } if (!((item2.SubmenuItemHorizontalAlign == HorizontalAlign.NotSet) || (item2.SubmenuItemHorizontalAlign == HorizontalAlign.Left))) { liSub.Style[HtmlTextWriterStyle.TextAlign] = item2.SubmenuItemHorizontalAlign.ToString().ToLowerInvariant(); } liSub.Controls.Add(CreateLink(item2, secondLevelItemCssClass, true, m_ModernTheme)); if (m_ModernTheme) { ulMain.Controls.Add(liSub); } else { ulSub.Controls.Add(liSub); } } if (!m_ModernTheme) { liMain.Controls.Add(ulSub); } } } if (!m_ModernTheme) { liMain = new HtmlGenericControl("li"); liMain.Attributes["class"] = "L"; lbl = new Label(); lbl.Text = Resources.NonBreakingSpace; liMain.Controls.Add(lbl); ulMain.Controls.Add(liMain); } } } finally { if (ulMain != null) { ulMain.Dispose(); } if (liMain != null) { liMain.Dispose(); } if (ulSub != null) { ulSub.Dispose(); } if (liSub != null) { liSub.Dispose(); } if (lbl != null) { lbl.Dispose(); } } }