public override string GetDesignTimeHtml() { HtmlEditor control = CurrentControl as HtmlEditor; HtmlNodeBuilder nb = new HtmlNodeBuilder("div"); if (!String.IsNullOrEmpty(control.Text)) { nb.InnerProperty = control.Text; } else { nb.InnerProperty = String.Empty; } string styleStr = String.Empty; if (control.Height != Unit.Empty) { styleStr += String.Format("height:{0}px;", control.Height.Value); } styleStr += "border:solid 2px #999;padding:5px;"; styleStr += "width:80%;"; nb.SetProperty("style", styleStr); return control.GetDesignTimeHtml(nb.ToString()); }
public override string GetDesignTimeHtml() { TextArea control = CurrentControl as TextArea; HtmlNodeBuilder nb = new HtmlNodeBuilder("textarea"); if (!String.IsNullOrEmpty(control.Text)) { nb.InnerProperty = control.Text; } else if (!String.IsNullOrEmpty(control.EmptyText)) { nb.InnerProperty = control.EmptyText; } else { nb.InnerProperty = String.Empty; } string styleStr = String.Empty; if (control.Height != Unit.Empty) { styleStr += String.Format("height:{0}px;", control.Height.Value); } styleStr += "width:80%;"; nb.SetProperty("style", styleStr); return control.GetDesignTimeHtml(nb.ToString()); }
public override string GetDesignTimeHtml() { NumberBox control = CurrentControl as NumberBox; HtmlNodeBuilder nb = new HtmlNodeBuilder("input"); if (!String.IsNullOrEmpty(control.Text)) { nb.SetProperty("value", control.Text); } else if (!String.IsNullOrEmpty(control.EmptyText)) { nb.SetProperty("value", control.EmptyText); } else { nb.SetProperty("value", String.Empty); } nb.SetProperty("style", "width:80%;"); nb.SetProperty("type", "text"); string content = nb.ToString(); return control.GetDesignTimeHtml(content); }
public override string GetDesignTimeHtml() { TextArea control = CurrentControl as TextArea; HtmlNodeBuilder nb = new HtmlNodeBuilder("textarea"); if (!String.IsNullOrEmpty(control.Text)) { nb.InnerProperty = control.Text; } else if (!String.IsNullOrEmpty(control.EmptyText)) { nb.InnerProperty = control.EmptyText; } else { nb.InnerProperty = String.Empty; } string styleStr = String.Empty; if (control.Height != Unit.Empty) { styleStr += String.Format("height:{0}px;", control.Height.Value); } styleStr += "width:80%;"; nb.SetProperty("style", styleStr); return(control.GetDesignTimeHtml(nb.ToString())); }
private string GetInnerHtml() { string text = Text; if (EncodeText) { text = HttpUtility.HtmlEncode(text); } HtmlNodeBuilder htmlBuilder = new HtmlNodeBuilder("span"); if (!String.IsNullOrEmpty(ToolTip)) { ResolveTooltip(htmlBuilder); } if (!Enabled) { htmlBuilder.SetProperty("class", "x-item-disabled"); htmlBuilder.SetProperty("disabled", "disabled"); } htmlBuilder.InnerProperty = text; return(htmlBuilder.ToString()); }
public override string GetDesignTimeHtml() { TextBox control = CurrentControl as TextBox; HtmlNodeBuilder nb = new HtmlNodeBuilder("input"); if (!String.IsNullOrEmpty(control.Text)) { nb.SetProperty("value", control.Text); } else if (!String.IsNullOrEmpty(control.EmptyText)) { nb.SetProperty("value", control.EmptyText); } else { nb.SetProperty("value", String.Empty); } if (control.TextMode == TextMode.Text) { nb.SetProperty("type", "text"); } else { nb.SetProperty("type", "password"); } nb.SetProperty("style", "width:80%;"); return(control.GetDesignTimeHtml(nb.ToString())); }
public override string GetDesignTimeHtml() { NumberBox control = CurrentControl as NumberBox; HtmlNodeBuilder nb = new HtmlNodeBuilder("input"); if (!String.IsNullOrEmpty(control.Text)) { nb.SetProperty("value", control.Text); } else if (!String.IsNullOrEmpty(control.EmptyText)) { nb.SetProperty("value", control.EmptyText); } else { nb.SetProperty("value", String.Empty); } nb.SetProperty("style", "width:80%;"); nb.SetProperty("type", "text"); string content = nb.ToString(); return(control.GetDesignTimeHtml(content)); }
public override string GetDesignTimeHtml() { HtmlEditor control = CurrentControl as HtmlEditor; HtmlNodeBuilder nb = new HtmlNodeBuilder("div"); if (!String.IsNullOrEmpty(control.Text)) { nb.InnerProperty = control.Text; } else { nb.InnerProperty = String.Empty; } string styleStr = String.Empty; if (control.Height != Unit.Empty) { styleStr += String.Format("height:{0}px;", control.Height.Value); } styleStr += "border:solid 2px #999;padding:5px;"; styleStr += "width:80%;"; nb.SetProperty("style", styleStr); return(control.GetDesignTimeHtml(nb.ToString())); }
public override void RenderBeginTag(HtmlTextWriter writer) { base.RenderBeginTag(writer); HtmlNodeBuilder node = new HtmlNodeBuilder("embed"); node.SetProperty("align", "middle"); if (Width != Unit.Empty) { node.SetProperty("width", Width.Value.ToString()); } if (Height != Unit.Empty) { node.SetProperty("height", Height.Value.ToString()); } node.SetProperty("type", "application/x-shockwave-flash"); node.SetProperty("pluginspage", "http://www.adobe.com/go/getflashplayer"); node.SetProperty("bgcolor", BackgroundColor); node.SetProperty("allowscriptaccess", "sameDomain"); StringBuilder sb = new StringBuilder(); foreach (FlashParam param in Params) { sb.AppendFormat("{0}={1}&", param.ParamKey, param.ParamValue); } node.SetProperty("flashvars", sb.ToString().TrimEnd('&')); node.SetProperty("wmode", "transparent"); node.SetProperty("quality", "high"); node.SetProperty("src", ResolveUrl(SwfUrl)); writer.Write(node.ToString()); }
public override string GetDesignTimeHtml() { TextBox control = CurrentControl as TextBox; HtmlNodeBuilder nb = new HtmlNodeBuilder("input"); if (!String.IsNullOrEmpty(control.Text)) { nb.SetProperty("value", control.Text); } else if (!String.IsNullOrEmpty(control.EmptyText)) { nb.SetProperty("value", control.EmptyText); } else { nb.SetProperty("value", String.Empty); } if (control.TextMode == TextMode.Text) { nb.SetProperty("type", "text"); } else { nb.SetProperty("type", "password"); } nb.SetProperty("style", "width:80%;"); return control.GetDesignTimeHtml(nb.ToString()); }
public override string GetDesignTimeHtml(DesignerRegionCollection regions) { if (CurrentControl.Tabs.Count == 0) { return(GetEmptyDesignTimeHtml()); } // 1. Add tabs title list StringBuilder sb = new StringBuilder(); int tabIndex = 0; foreach (Tab tab in CurrentControl.Tabs) { HtmlNodeBuilder nb = new HtmlNodeBuilder("div"); if (!String.IsNullOrEmpty(tab.Title)) { nb.InnerProperty = tab.Title; } else { nb.InnerProperty = String.Format("[{0}]", tab.ID); } string styleStr = "padding:0 5px;margin-right:5px;display:inline;"; if (CurrentControl.ActiveTabIndex == tabIndex) { styleStr += "background-color:#666;"; } nb.SetProperty("style", styleStr); nb.SetProperty(DesignerRegion.DesignerRegionAttributeName, tabIndex.ToString()); DesignerRegion region = new DesignerRegion(this, "Tab_" + tabIndex, true); region.Properties["TabIndex"] = tabIndex.ToString(); regions.Add(region); sb.Append(nb.ToString()); tabIndex++; } string tabsHtml = sb.ToString(); // 2. Add current active tab content // Note: Currently, we have add (CurrentControl.Tabs.Count - 1) items into regions, // So This editable region's index is CurrentControl.Tabs.Count. EditableDesignerRegion editableRegion = new EditableDesignerRegion(this, "Content", true); regions.Add(editableRegion); //editableRegion.Properties["ActiveTabIndex"] = CurrentControl.ActiveTabIndex.ToString(); string contentHtml = String.Format("<div {0}='{1}'>{2}</div>", DesignerRegion.DesignerRegionAttributeName, CurrentControl.Tabs.Count, GetEditableDesignerRegionContent(editableRegion)); return(String.Format(PANEL_TEMPLATE, tabsHtml, contentHtml)); }
public override string GetDesignTimeHtml(DesignerRegionCollection regions) { if (CurrentControl.Tabs.Count == 0) { return GetEmptyDesignTimeHtml(); } // 1. Add tabs title list StringBuilder sb = new StringBuilder(); int tabIndex = 0; foreach (Tab tab in CurrentControl.Tabs) { HtmlNodeBuilder nb = new HtmlNodeBuilder("div"); if (!String.IsNullOrEmpty(tab.Title)) { nb.InnerProperty = tab.Title; } else { nb.InnerProperty = String.Format("[{0}]", tab.ID); } string styleStr = "padding:0 5px;margin-right:5px;display:inline;"; if (CurrentControl.ActiveTabIndex == tabIndex) { styleStr += "background-color:#666;"; } nb.SetProperty("style", styleStr); nb.SetProperty(DesignerRegion.DesignerRegionAttributeName, tabIndex.ToString()); DesignerRegion region = new DesignerRegion(this, "Tab_" + tabIndex, true); region.Properties["TabIndex"] = tabIndex.ToString(); regions.Add(region); sb.Append(nb.ToString()); tabIndex++; } string tabsHtml = sb.ToString(); // 2. Add current active tab content // Note: Currently, we have add (CurrentControl.Tabs.Count - 1) items into regions, // So This editable region's index is CurrentControl.Tabs.Count. EditableDesignerRegion editableRegion = new EditableDesignerRegion(this, "Content", true); regions.Add(editableRegion); //editableRegion.Properties["ActiveTabIndex"] = CurrentControl.ActiveTabIndex.ToString(); string contentHtml = String.Format("<div {0}='{1}'>{2}</div>", DesignerRegion.DesignerRegionAttributeName, CurrentControl.Tabs.Count, GetEditableDesignerRegionContent(editableRegion)); return String.Format(PANEL_TEMPLATE, tabsHtml, contentHtml); }
public override string GetDesignTimeHtml() { Button control = CurrentControl as Button; HtmlNodeBuilder nb = new HtmlNodeBuilder("input"); nb.SetProperty("value", String.IsNullOrEmpty(control.Text) ? ID : control.Text); nb.SetProperty("type", "button"); return nb.ToString(); }
public override string GetDesignTimeHtml() { Button control = CurrentControl as Button; HtmlNodeBuilder nb = new HtmlNodeBuilder("input"); nb.SetProperty("value", String.IsNullOrEmpty(control.Text) ? ID : control.Text); nb.SetProperty("type", "button"); return(nb.ToString()); }
protected void ResolveTooltip(HtmlNodeBuilder htmlBuilder) { if (!String.IsNullOrEmpty(ToolTip)) { htmlBuilder.SetProperty("ext:qtip", ToolTip); if (!String.IsNullOrEmpty(ToolTipTitle)) { htmlBuilder.SetProperty("ext:qtitle", ToolTipTitle); } if (!ToolTipAutoHide) { htmlBuilder.SetProperty("ext:hide", "false"); } } }
private string GetInnerHtml() { HtmlNodeBuilder htmlBuilder = new HtmlNodeBuilder("a"); if (Enabled) { if (!String.IsNullOrEmpty(NavigateUrl)) { if (NavigateUrl == "#") { htmlBuilder.SetProperty("href", "#"); } else { htmlBuilder.SetProperty("href", ResolveUrl(NavigateUrl)); } } if (!String.IsNullOrEmpty(Target)) { htmlBuilder.SetProperty("target", Target); } if (!String.IsNullOrEmpty(OnClientClick)) { htmlBuilder.SetProperty("onclick", "javascript:" + OnClientClick); } } else { htmlBuilder.SetProperty("class", "x-item-disabled"); htmlBuilder.SetProperty("disabled", "disabled"); } ResolveTooltip(htmlBuilder); string text = Text; if (EncodeText) { text = HttpUtility.HtmlEncode(text); } htmlBuilder.InnerProperty = text; return(htmlBuilder.ToString()); }
//private static readonly string BUTTON_TEMPLATE = "<table style='width: auto;display:inline;' class='x-btn-wrap x-btn #DISABLED_CLASSNAME#' border='0' cellpadding='0' cellspacing='0'><tbody><tr><td class='x-btn-left'><i> </i></td><td class='x-btn-center'><em unselectable='on'><button class='x-btn-text' type='button'>#TEXT#</button></em></td><td class='x-btn-right'><i> </i></td></tr></tbody></table>"; public override string GetDesignTimeHtml() { Button control = CurrentControl as Button; HtmlNodeBuilder nb = new HtmlNodeBuilder("input"); nb.SetProperty("value", String.IsNullOrEmpty(control.Text) ? ID : control.Text); nb.SetProperty("type", "button"); //if(!control.Enabled) //{ // nb.SetProperty("disabled", "disabled"); //} return(nb.ToString()); #region old code //string content = BUTTON_TEMPLATE; //if (String.IsNullOrEmpty(control.Text)) //{ // content = content.Replace("#TEXT#", String.Format("[{0}]", control.ID)); //} //else //{ // content = content.Replace("#TEXT#", control.Text); //} //if (control.Enabled) //{ // content = content.Replace("#DISABLED_CLASSNAME#", String.Empty); //} //else //{ // content = content.Replace("#DISABLED_CLASSNAME#", DISABLED_CLASSNAME); //} //return base.GetDesignTimeHtml() + content; //return CreatePlaceHolderDesignTimeHtml(); #endregion }
public override string GetDesignTimeHtml() { CheckBox control = CurrentControl as CheckBox; string content = String.Empty; HtmlNodeBuilder nb = new HtmlNodeBuilder("input"); nb.SetProperty("type", "checkbox"); if (control.Checked) { nb.SetProperty("checked", "checked"); } content = nb.ToString(); if (!String.IsNullOrEmpty(control.Text)) { content += control.Text; } return control.GetDesignTimeHtml(content); }
//private static readonly string BUTTON_TEMPLATE = "<table style='width: auto;display:inline;' class='x-btn-wrap x-btn #DISABLED_CLASSNAME#' border='0' cellpadding='0' cellspacing='0'><tbody><tr><td class='x-btn-left'><i> </i></td><td class='x-btn-center'><em unselectable='on'><button class='x-btn-text' type='button'>#TEXT#</button></em></td><td class='x-btn-right'><i> </i></td></tr></tbody></table>"; public override string GetDesignTimeHtml() { Button control = CurrentControl as Button; HtmlNodeBuilder nb = new HtmlNodeBuilder("input"); nb.SetProperty("value", String.IsNullOrEmpty(control.Text) ? ID : control.Text); nb.SetProperty("type", "button"); //if(!control.Enabled) //{ // nb.SetProperty("disabled", "disabled"); //} return nb.ToString(); #region old code //string content = BUTTON_TEMPLATE; //if (String.IsNullOrEmpty(control.Text)) //{ // content = content.Replace("#TEXT#", String.Format("[{0}]", control.ID)); //} //else //{ // content = content.Replace("#TEXT#", control.Text); //} //if (control.Enabled) //{ // content = content.Replace("#DISABLED_CLASSNAME#", String.Empty); //} //else //{ // content = content.Replace("#DISABLED_CLASSNAME#", DISABLED_CLASSNAME); //} //return base.GetDesignTimeHtml() + content; //return CreatePlaceHolderDesignTimeHtml(); #endregion }
private string GetInnerHtml() { string text = Text; if (EncodeText) { text = HttpUtility.HtmlEncode(text); } HtmlNodeBuilder htmlBuilder = new HtmlNodeBuilder("a"); if (Enabled) { htmlBuilder.SetProperty("href", "javascript:;"); // ValidateForms/Click string clientScript = Button.ResolveClientScript(ValidateForms, ValidateTarget, ValidateMessageBox, EnablePostBack, GetPostBackEventReference(), ConfirmText, ConfirmTitle, ConfirmIcon, ConfirmTarget, OnClientClick, String.Empty); htmlBuilder.SetProperty("onclick", String.Format("javascript:{0}", clientScript)); if (TabIndex != null) { htmlBuilder.SetProperty("tabindex", TabIndex.Value.ToString()); } } else { //htmlBuilder.SetProperty("class", "gray"); htmlBuilder.SetProperty("class", "x-item-disabled"); htmlBuilder.SetProperty("disabled", "disabled"); } ResolveTooltip(htmlBuilder); htmlBuilder.InnerProperty = text; return(htmlBuilder.ToString()); }
public override string GetDesignTimeHtml() { CheckBox control = CurrentControl as CheckBox; string content = String.Empty; HtmlNodeBuilder nb = new HtmlNodeBuilder("input"); nb.SetProperty("type", "checkbox"); if (control.Checked) { nb.SetProperty("checked", "checked"); } content = nb.ToString(); if (!String.IsNullOrEmpty(control.Text)) { content += control.Text; } return(control.GetDesignTimeHtml(content)); }
private string GetInnerHtml() { HtmlNodeBuilder htmlBuilder = new HtmlNodeBuilder("img"); if (!String.IsNullOrEmpty(ImageUrl)) { htmlBuilder.SetProperty("src", ResolveUrl(ImageUrl)); } if (ImageWidth != Unit.Empty) { htmlBuilder.SetProperty("width", String.Format("{0}px", ImageWidth.Value)); } if (ImageHeight != Unit.Empty) { htmlBuilder.SetProperty("height", String.Format("{0}px", ImageHeight.Value)); } if (!String.IsNullOrEmpty(ImageCssClass)) { htmlBuilder.SetProperty("class", ImageCssClass); } if (!String.IsNullOrEmpty(ImageCssStyle)) { htmlBuilder.SetProperty("style", ImageCssStyle); } if (!String.IsNullOrEmpty(ImageAlt)) { htmlBuilder.SetProperty("alt", ImageAlt); } ResolveTooltip(htmlBuilder); return(htmlBuilder.ToString()); }
internal override string GetColumnValue(GridRow row) { //string result = String.Empty; #region DataTextField string text = String.Empty; if (!String.IsNullOrEmpty(DataTextField)) { object value = row.GetPropertyValue(DataTextField); if (!String.IsNullOrEmpty(DataTextFormatString)) { text = String.Format(DataTextFormatString, value); if (HtmlEncodeFormatString) { text = HttpUtility.HtmlEncode(text); } } else { text = value.ToString(); if (HtmlEncode) { text = HttpUtility.HtmlEncode(text); } } } else { text = Text; } #endregion HtmlNodeBuilder nb; #region Enabled nb = new HtmlNodeBuilder("a"); if (Enabled) { nb.SetProperty("href", "javascript:;"); // click string paramStr = String.Format("Command${0}${1}${2}${3}", row.RowIndex, ColumnIndex, CommandName.Replace("'", "\""), CommandArgument.Replace("'", "\"")); string postBackReference = Grid.GetPostBackEventReference(paramStr); string clientScript = Button.ResolveClientScript(ValidateForms, ValidateTarget, ValidateMessageBox, EnablePostBack, postBackReference, ConfirmText, ConfirmTitle, ConfirmIcon, ConfirmTarget, OnClientClick, String.Empty); clientScript = JsHelper.GetDeferScript(clientScript, 0) + "X.util.stopEventPropagation.apply(null, arguments);"; nb.SetProperty("onclick", clientScript); //result = nb.ToString(); } else { nb.SetProperty("class", "x-item-disabled"); nb.SetProperty("disabled", "disabled"); //nb = new HtmlNodeBuilder("span"); //nb.SetProperty("class", "gray"); //nb.InnerProperty = text; //result = String.Format("<span class=\"gray\">{0}</span>", text); } nb.InnerProperty = text; #endregion string tooltip = GetTooltipString(row); #region Icon IconUrl string resolvedIconUrl = IconHelper.GetResolvedIconUrl(Icon, IconUrl); if (!String.IsNullOrEmpty(resolvedIconUrl)) { nb.InnerProperty = String.Format("<img src=\"{0}\" {1} />", resolvedIconUrl, tooltip) + nb.InnerProperty; } #endregion //string result = nb.ToString(); //#region Tooltip //if (!String.IsNullOrEmpty(tooltip)) //{ // if (result.StartsWith("<a ")) // { // result = result.ToString().Insert(2, tooltip); // } // else if (result.StartsWith("<span ")) // { // result = result.ToString().Insert(5, tooltip); // } //} //#endregion //return result; string result = nb.ToString(); if (!String.IsNullOrEmpty(tooltip)) { result = result.ToString().Insert("<a".Length, tooltip); } return result; }
internal override string GetColumnValue(GridRow row) { HtmlNodeBuilder nb = new HtmlNodeBuilder("a"); #region DataTextField if (!String.IsNullOrEmpty(DataTextField)) { object value = row.GetPropertyValue(DataTextField); string text = String.Empty; if (!String.IsNullOrEmpty(DataTextFormatString)) { text = String.Format(DataTextFormatString, value); if (HtmlEncodeFormatString) { text = HttpUtility.HtmlEncode(text); } } else { text = value.ToString(); if (HtmlEncode) { text = HttpUtility.HtmlEncode(text); } } nb.InnerProperty = text; } else { nb.InnerProperty = Text; } #endregion if (Enabled) { #region DataNavigateUrlFields string hrefOriginal = String.Empty; if (DataNavigateUrlFields != null && DataNavigateUrlFields.Length > 0) { //string[] fields = DataNavigateUrlFields.Trim().TrimEnd(',').Split(','); string[] fields = DataNavigateUrlFields; List<object> fieldValues = new List<object>(); foreach (string field in fields) { if (!String.IsNullOrEmpty(field)) { string fieldValue = row.GetPropertyValue(field).ToString(); if (UrlEncode) { fieldValue = HttpUtility.UrlEncode(fieldValue); } fieldValues.Add(fieldValue); } } if (!String.IsNullOrEmpty(DataNavigateUrlFormatString)) { hrefOriginal = String.Format(DataNavigateUrlFormatString, fieldValues.ToArray()); } else { if (fieldValues.Count > 0) { hrefOriginal = fieldValues[0].ToString(); } } } else { hrefOriginal = NavigateUrl; } nb.SetProperty("href", Grid.ResolveUrl(hrefOriginal)); #endregion #region Target if (!String.IsNullOrEmpty(Target)) { nb.SetProperty("target", Target); } else { nb.SetProperty("target", "_blank"); } #endregion nb.SetProperty("onclick", "X.util.stopEventPropagation.apply(null, arguments);"); } else { nb.SetProperty("class", "x-item-disabled"); nb.SetProperty("disabled", "disabled"); } //string result2 = nb.ToString(); //string tooltip = GetTooltipString(row); //if (!String.IsNullOrEmpty(tooltip)) //{ // result2 = result2.ToString().Insert(2, tooltip); //} //return result2; string result = nb.ToString(); string tooltip = GetTooltipString(row); if (!String.IsNullOrEmpty(tooltip)) { result = result.ToString().Insert("<a".Length, tooltip); } return result; }
private string GetInnerHtml() { HtmlNodeBuilder htmlBuilder = new HtmlNodeBuilder("a"); if (Enabled) { if (!String.IsNullOrEmpty(NavigateUrl)) { if (NavigateUrl == "#") { htmlBuilder.SetProperty("href", "#"); } else { htmlBuilder.SetProperty("href", ResolveUrl(NavigateUrl)); } } if (!String.IsNullOrEmpty(Target)) { htmlBuilder.SetProperty("target", Target); } if (!String.IsNullOrEmpty(OnClientClick)) { htmlBuilder.SetProperty("onclick", "javascript:" + OnClientClick); } } else { htmlBuilder.SetProperty("class", "x-item-disabled"); htmlBuilder.SetProperty("disabled", "disabled"); } ResolveTooltip(htmlBuilder); string text = Text; if (EncodeText) { text = HttpUtility.HtmlEncode(text); } htmlBuilder.InnerProperty = text; return htmlBuilder.ToString(); }
private string GetInnerHtml() { string text = Text; if (EncodeText) { text = HttpUtility.HtmlEncode(text); } HtmlNodeBuilder htmlBuilder = new HtmlNodeBuilder("span"); if (!String.IsNullOrEmpty(ToolTip)) { ResolveTooltip(htmlBuilder); } if (!Enabled) { htmlBuilder.SetProperty("class", "x-item-disabled"); htmlBuilder.SetProperty("disabled", "disabled"); } htmlBuilder.InnerProperty = text; return htmlBuilder.ToString(); }
internal override string GetColumnValue(GridRow row) { HtmlNodeBuilder nb = new HtmlNodeBuilder("a"); #region DataTextField if (!String.IsNullOrEmpty(DataTextField)) { object value = row.GetPropertyValue(DataTextField); //if (!String.IsNullOrEmpty(DataTextFormatString)) //{ // nb.InnerProperty = String.Format(DataTextFormatString, value); //} //else //{ // nb.InnerProperty = value.ToString(); //} string text = String.Empty; if (!String.IsNullOrEmpty(DataTextFormatString)) { text = String.Format(DataTextFormatString, value); if (HtmlEncodeFormatString) { text = HttpUtility.HtmlEncode(text); } } else { text = value.ToString(); if (HtmlEncode) { text = HttpUtility.HtmlEncode(text); } } nb.InnerProperty = text; } else { nb.InnerProperty = Text; } #endregion if (Enabled) { string url = "#"; #region DataIFrameUrlFields string hrefOriginal = String.Empty; if (!String.IsNullOrEmpty(DataIFrameUrlFields)) { string[] fields = DataIFrameUrlFields.Trim().TrimEnd(',').Split(','); List<object> fieldValues = new List<object>(); foreach (string field in fields) { if (!String.IsNullOrEmpty(field)) { //fieldValues.Add(row.GetPropertyValue(field)); string fieldValue = row.GetPropertyValue(field).ToString(); if (UrlEncode) { fieldValue = HttpUtility.UrlEncode(fieldValue); } fieldValues.Add(fieldValue); } } if (!String.IsNullOrEmpty(DataIFrameUrlFormatString)) { hrefOriginal = String.Format(DataIFrameUrlFormatString, fieldValues.ToArray()); } else { if (fieldValues.Count > 0) { hrefOriginal = fieldValues[0].ToString(); } } } else { hrefOriginal = IFrameUrl; } url = Grid.ResolveUrl(hrefOriginal); #endregion string title = String.Empty; #region DataTextField if (!String.IsNullOrEmpty(DataWindowTitleField)) { object value = row.GetPropertyValue(DataWindowTitleField); if (!String.IsNullOrEmpty(DataWindowTitleFormatString)) { title = String.Format(DataWindowTitleFormatString, value); } else { title = value.ToString(); } } else { title = Title; } #endregion #region WindowID if (!String.IsNullOrEmpty(WindowID)) { Window window = ControlUtil.FindControl(Grid.Page, WindowID) as Window; if (window != null) { nb.SetProperty("href", "javascript:;"); nb.SetProperty("onclick", String.Format("javascript:{0}", window.GetShowReference(url, title))); //nb.SetProperty("href", String.Format("javascript:X.{0}_show('{1}','{2}');", window.ClientID, url, title.Replace("'", "\""))); } } #endregion } else { nb.SetProperty("class", "x-item-disabled"); nb.SetProperty("disabled", "disabled"); } string tooltip = GetTooltipString(row); #region Icon IconUrl string resolvedIconUrl = IconHelper.GetResolvedIconUrl(Icon, IconUrl); if (!String.IsNullOrEmpty(resolvedIconUrl)) { nb.InnerProperty = String.Format("<img src=\"{0}\" {1} />", resolvedIconUrl, tooltip) + nb.InnerProperty; } #endregion //string result2 = nb.ToString(); //#region Tooltip //if (!String.IsNullOrEmpty(tooltip)) //{ // result2 = result2.ToString().Insert(2, tooltip); //} //#endregion //return result2; string result = nb.ToString(); if (!String.IsNullOrEmpty(tooltip)) { result = result.ToString().Insert("<a".Length, tooltip); } return result; }
internal override string GetColumnValue(GridRow row) { string text = String.Empty; if (!String.IsNullOrEmpty(DataField)) { object value = row.GetPropertyValue(DataField); if (value == null) { text = NullDisplayText; } else { if (!String.IsNullOrEmpty(DataFormatString)) { text = String.Format(DataFormatString, value); if (HtmlEncodeFormatString) { text = HttpUtility.HtmlEncode(text); } } else { text = value.ToString(); if (HtmlEncode) { text = HttpUtility.HtmlEncode(text); } } } } HtmlNodeBuilder nb = new HtmlNodeBuilder("span"); nb.InnerProperty = text; if (!Enabled) { nb.SetProperty("class", "x-item-disabled"); nb.SetProperty("disabled", "disabled"); } string result = nb.ToString(); string tooltip = GetTooltipString(row); if (!String.IsNullOrEmpty(tooltip)) { result = result.ToString().Insert("<span".Length, tooltip); } // 如果结果是 <span>绑定的数据</span> if (result.StartsWith("<span>")) { result = result.Substring("<span>".Length, result.Length - "<span></span>".Length); } return(result); }
private string GetInnerHtml() { HtmlNodeBuilder htmlBuilder = new HtmlNodeBuilder("img"); if (!String.IsNullOrEmpty(ImageUrl)) { htmlBuilder.SetProperty("src", ResolveUrl(ImageUrl)); } if (ImageWidth != Unit.Empty) { htmlBuilder.SetProperty("width", String.Format("{0}px", ImageWidth.Value)); } if (ImageHeight != Unit.Empty) { htmlBuilder.SetProperty("height", String.Format("{0}px", ImageHeight.Value)); } if (!String.IsNullOrEmpty(ImageCssClass)) { htmlBuilder.SetProperty("class", ImageCssClass); } if (!String.IsNullOrEmpty(ImageCssStyle)) { htmlBuilder.SetProperty("style", ImageCssStyle); } if (!String.IsNullOrEmpty(ImageAlt)) { htmlBuilder.SetProperty("alt", ImageAlt); } ResolveTooltip(htmlBuilder); return htmlBuilder.ToString(); }
internal override string GetColumnValue(GridRow row) { string text = String.Empty; if (!String.IsNullOrEmpty(DataField)) { object value = row.GetPropertyValue(DataField); if (value == null) { text = NullDisplayText; } else { if (!String.IsNullOrEmpty(DataFormatString)) { text = String.Format(DataFormatString, value); if (HtmlEncodeFormatString) { text = HttpUtility.HtmlEncode(text); } } else { text = value.ToString(); if (HtmlEncode) { text = HttpUtility.HtmlEncode(text); } } } } HtmlNodeBuilder nb = new HtmlNodeBuilder("span"); nb.InnerProperty = text; if (!Enabled) { nb.SetProperty("class", "x-item-disabled"); nb.SetProperty("disabled", "disabled"); } string result = nb.ToString(); string tooltip = GetTooltipString(row); if (!String.IsNullOrEmpty(tooltip)) { result = result.ToString().Insert("<span".Length, tooltip); } // 如果结果是 <span>绑定的数据</span> if (result.StartsWith("<span>")) { result = result.Substring("<span>".Length, result.Length - "<span></span>".Length); } return result; }
internal override string GetColumnValue(GridRow row) { HtmlNodeBuilder nb = new HtmlNodeBuilder("a"); #region DataTextField if (!String.IsNullOrEmpty(DataTextField)) { object value = row.GetPropertyValue(DataTextField); string text = String.Empty; if (!String.IsNullOrEmpty(DataTextFormatString)) { text = String.Format(DataTextFormatString, value); if (HtmlEncodeFormatString) { text = HttpUtility.HtmlEncode(text); } } else { text = value.ToString(); if (HtmlEncode) { text = HttpUtility.HtmlEncode(text); } } nb.InnerProperty = text; } else { nb.InnerProperty = Text; } #endregion if (Enabled) { #region DataNavigateUrlFields string hrefOriginal = String.Empty; if (DataNavigateUrlFields != null && DataNavigateUrlFields.Length > 0) { //string[] fields = DataNavigateUrlFields.Trim().TrimEnd(',').Split(','); string[] fields = DataNavigateUrlFields; List <object> fieldValues = new List <object>(); foreach (string field in fields) { if (!String.IsNullOrEmpty(field)) { string fieldValue = row.GetPropertyValue(field).ToString(); if (UrlEncode) { fieldValue = HttpUtility.UrlEncode(fieldValue); } fieldValues.Add(fieldValue); } } if (!String.IsNullOrEmpty(DataNavigateUrlFormatString)) { hrefOriginal = String.Format(DataNavigateUrlFormatString, fieldValues.ToArray()); } else { if (fieldValues.Count > 0) { hrefOriginal = fieldValues[0].ToString(); } } } else { hrefOriginal = NavigateUrl; } nb.SetProperty("href", Grid.ResolveUrl(hrefOriginal)); #endregion #region Target if (!String.IsNullOrEmpty(Target)) { nb.SetProperty("target", Target); } else { nb.SetProperty("target", "_blank"); } #endregion nb.SetProperty("onclick", "X.util.stopEventPropagation.apply(null, arguments);"); } else { nb.SetProperty("class", "x-item-disabled"); nb.SetProperty("disabled", "disabled"); } //string result2 = nb.ToString(); //string tooltip = GetTooltipString(row); //if (!String.IsNullOrEmpty(tooltip)) //{ // result2 = result2.ToString().Insert(2, tooltip); //} //return result2; string result = nb.ToString(); string tooltip = GetTooltipString(row); if (!String.IsNullOrEmpty(tooltip)) { result = result.ToString().Insert("<a".Length, tooltip); } return(result); }
internal override string GetColumnValue(GridRow row) { //string result = String.Empty; #region DataTextField string text = String.Empty; if (!String.IsNullOrEmpty(DataTextField)) { object value = row.GetPropertyValue(DataTextField); if (!String.IsNullOrEmpty(DataTextFormatString)) { text = String.Format(DataTextFormatString, value); if (HtmlEncodeFormatString) { text = HttpUtility.HtmlEncode(text); } } else { text = value.ToString(); if (HtmlEncode) { text = HttpUtility.HtmlEncode(text); } } } else { text = Text; } #endregion HtmlNodeBuilder nb; #region Enabled nb = new HtmlNodeBuilder("a"); if (Enabled) { nb.SetProperty("href", "javascript:;"); // click string paramStr = String.Format("Command${0}${1}${2}${3}", row.RowIndex, ColumnIndex, CommandName.Replace("'", "\""), CommandArgument.Replace("'", "\"")); string postBackReference = Grid.GetPostBackEventReference(paramStr); string clientScript = Button.ResolveClientScript(ValidateForms, ValidateTarget, ValidateMessageBox, EnablePostBack, postBackReference, ConfirmText, ConfirmTitle, ConfirmIcon, ConfirmTarget, OnClientClick, String.Empty); clientScript = JsHelper.GetDeferScript(clientScript, 0) + "X.util.stopEventPropagation.apply(null, arguments);"; nb.SetProperty("onclick", clientScript); //result = nb.ToString(); } else { nb.SetProperty("class", "x-item-disabled"); nb.SetProperty("disabled", "disabled"); //nb = new HtmlNodeBuilder("span"); //nb.SetProperty("class", "gray"); //nb.InnerProperty = text; //result = String.Format("<span class=\"gray\">{0}</span>", text); } nb.InnerProperty = text; #endregion string tooltip = GetTooltipString(row); #region Icon IconUrl string resolvedIconUrl = IconHelper.GetResolvedIconUrl(Icon, IconUrl); if (!String.IsNullOrEmpty(resolvedIconUrl)) { nb.InnerProperty = String.Format("<img src=\"{0}\" {1} />", resolvedIconUrl, tooltip) + nb.InnerProperty; } #endregion //string result = nb.ToString(); //#region Tooltip //if (!String.IsNullOrEmpty(tooltip)) //{ // if (result.StartsWith("<a ")) // { // result = result.ToString().Insert(2, tooltip); // } // else if (result.StartsWith("<span ")) // { // result = result.ToString().Insert(5, tooltip); // } //} //#endregion //return result; string result = nb.ToString(); if (!String.IsNullOrEmpty(tooltip)) { result = result.ToString().Insert("<a".Length, tooltip); } return(result); }
internal override string GetColumnValue(GridRow row) { HtmlNodeBuilder nb = new HtmlNodeBuilder("a"); #region DataTextField if (!String.IsNullOrEmpty(DataTextField)) { object value = row.GetPropertyValue(DataTextField); //if (!String.IsNullOrEmpty(DataTextFormatString)) //{ // nb.InnerProperty = String.Format(DataTextFormatString, value); //} //else //{ // nb.InnerProperty = value.ToString(); //} string text = String.Empty; if (!String.IsNullOrEmpty(DataTextFormatString)) { text = String.Format(DataTextFormatString, value); if (HtmlEncodeFormatString) { text = HttpUtility.HtmlEncode(text); } } else { text = value.ToString(); if (HtmlEncode) { text = HttpUtility.HtmlEncode(text); } } nb.InnerProperty = text; } else { nb.InnerProperty = Text; } #endregion if (Enabled) { string url = "#"; #region DataIFrameUrlFields string hrefOriginal = String.Empty; if (!String.IsNullOrEmpty(DataIFrameUrlFields)) { string[] fields = DataIFrameUrlFields.Trim().TrimEnd(',').Split(','); List <object> fieldValues = new List <object>(); foreach (string field in fields) { if (!String.IsNullOrEmpty(field)) { //fieldValues.Add(row.GetPropertyValue(field)); string fieldValue = row.GetPropertyValue(field).ToString(); if (UrlEncode) { fieldValue = HttpUtility.UrlEncode(fieldValue); } fieldValues.Add(fieldValue); } } if (!String.IsNullOrEmpty(DataIFrameUrlFormatString)) { hrefOriginal = String.Format(DataIFrameUrlFormatString, fieldValues.ToArray()); } else { if (fieldValues.Count > 0) { hrefOriginal = fieldValues[0].ToString(); } } } else { hrefOriginal = IFrameUrl; } url = Grid.ResolveUrl(hrefOriginal); #endregion string title = String.Empty; #region DataTextField if (!String.IsNullOrEmpty(DataWindowTitleField)) { object value = row.GetPropertyValue(DataWindowTitleField); if (!String.IsNullOrEmpty(DataWindowTitleFormatString)) { title = String.Format(DataWindowTitleFormatString, value); } else { title = value.ToString(); } } else { title = Title; } #endregion #region WindowID if (!String.IsNullOrEmpty(WindowID)) { Window window = ControlUtil.FindControl(Grid.Page, WindowID) as Window; if (window != null) { nb.SetProperty("href", "javascript:;"); nb.SetProperty("onclick", String.Format("javascript:{0}", window.GetShowReference(url, title))); //nb.SetProperty("href", String.Format("javascript:X.{0}_show('{1}','{2}');", window.ClientID, url, title.Replace("'", "\""))); } } #endregion } else { nb.SetProperty("class", "x-item-disabled"); nb.SetProperty("disabled", "disabled"); } string tooltip = GetTooltipString(row); #region Icon IconUrl string resolvedIconUrl = IconHelper.GetResolvedIconUrl(Icon, IconUrl); if (!String.IsNullOrEmpty(resolvedIconUrl)) { nb.InnerProperty = String.Format("<img src=\"{0}\" {1} />", resolvedIconUrl, tooltip) + nb.InnerProperty; } #endregion //string result2 = nb.ToString(); //#region Tooltip //if (!String.IsNullOrEmpty(tooltip)) //{ // result2 = result2.ToString().Insert(2, tooltip); //} //#endregion //return result2; string result = nb.ToString(); if (!String.IsNullOrEmpty(tooltip)) { result = result.ToString().Insert("<a".Length, tooltip); } return(result); }