internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell) { string image = FileSource(false, cell); if (HyperLinkColumn && Grid.DisplayView == DisplayView.Grid) { string a = Grid.EnableCallBack ? Asynchronous.GetCallbackEventReference(Grid, string.Format("RecordClick!{0}!{1}", ColumnId, cell.Row.PrimaryKeyValues), false, string.Empty, string.Empty) : Grid.Page.ClientScript.GetPostBackEventReference(Grid, string.Format("RecordClick!{0}!{1}", ColumnId, cell.Row. PrimaryKeyValues)); string b = (String.IsNullOrEmpty(ConfirmMessage)) ? string.Empty : String.Format("if(wgconfirm('{0}',this,'{1}')) ", ConfirmMessage.Replace("'", "\\'"), Grid.DialogTitle.Replace("'", "\\'")); image = string.Format( "<a class=\"wglinkfield\" href=\"#\" onclick=\"{0}{1}\">{2}</a>", b, a, image); } LabelHtml(image, writer, cell); }
// string optimize internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell) { string s = Value(cell); if (IsUrl && string.IsNullOrEmpty(s) == false && s.Length > 0) { //if( s.ToLowerInvariant() .StartsWith("http") == false ) if (String.Compare(s, 0, "http", 0, 4, true) != 0) { s = HTTPCONST + s; } s = ColumnGridAlias != null?string.Format( "<a class=\"wglinkfield\" href=\"{0}\" target=\"_blank\">{1}</a>", s, ColumnGridAlias) : string.Format("<a class=\"wglinkfield\" href=\"{0}\" target=\"_blank\">{1}</a>", s, s); } if (IsEmail && !string.IsNullOrEmpty(s)) { s = ColumnGridAlias != null?string.Format( "<a class=\"wglinkfield\" href=\"mailto:{0}\">{1}</a>", s, ColumnGridAlias) : string.Format("<a class=\"wglinkfield\" href=\"mailto:{0}\" >{1}</a>", s, s); } if (IsPassword && PasswordString != null) { s = PasswordString; } cell.Value = s; base.RenderLabelView(writer, cell); }
internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell) { if (cell.Value != null && Visibility != Visibility.None) { writer.Write(RenderTemplate(cell)); } }
internal string DrawHtml(string uniqueID, WebGridHtmlWriter writer, Grid grid, RowCell cell) { string theValueToShow = Value(cell); HtmlEditor e = new HtmlEditor { ID = uniqueID, ImagePath = Grid.ImagePath, UserBRonCarriageReturn = true, Width = (WidthEditableColumn != Unit.Empty ? WidthEditableColumn : 500), Height = (HeightEditableColumn != Unit.Empty ? HeightEditableColumn : 400), Text = theValueToShow }; e.ImagePath = GridConfig.Get("WGEditorImagePath", grid.ImagePath); StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); System.Web.UI.HtmlTextWriter mywriter = new System.Web.UI.HtmlTextWriter(sw); e.RenderControl(mywriter); mywriter.Flush(); mywriter.Close(); return(sb.ToString()); }
internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell) { if (!string.IsNullOrEmpty(Sum) && cell.Row.RowType == RowType.DataRow) { cell.Value = GetSum(cell); } base.RenderLabelView(writer, cell); }
internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { if (AllowEdit == false) { RenderLabelView(writer, cell); return; } m_IsFormElement = false; RenderDetail(true, writer, cell); }
internal static void AddClientScript(WebGridHtmlWriter writer, string scriptcontent) { if (Anthem.Manager.IsCallBack) { Anthem.Manager.AddScriptForClientSideEval(scriptcontent); } else { writer.Write(string.Format(@"<script type=""text/javascript"">{0}</script>", scriptcontent)); } }
internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { if (Identity || AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false)) { RenderLabelView(writer, cell); return; } if (Sum != null && cell.Row.RowType == RowType.DataRow) { decimal?unusedVar = GetSum(cell); } base.RenderEditView(writer, cell); }
// 2005.01.09 - jorn, string optimize, String.Compare internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { if (AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false)) { RenderLabelView(writer, cell); return; } base.RenderEditView(writer, cell); if (DisplayCalendar && Grid.GotHttpContext) { Grid.AddClientScript(writer, string.Format(calendarsetup, cell.CellClientId, CalendarFormat, AddCalendarClientAttributes, Grid.Page.ClientScript.GetWebResourceUrl(Grid.GetType(), "WebGrid.Resources.images.calendar.gif"))); } }
internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { StringBuilder sb = new StringBuilder(); GetColumnPostBackData(cell); EnsureItems(cell); if (Items.Count > 0) { string strHeight = "5"; if (HeightEditableColumn != Unit.Empty) { strHeight = HeightEditableColumn.Value.ToString(); } if (ManyToManyType == ManyToManyType.Multiselect) { sb.AppendFormat( "<select size={0} multiple=\"multiple\" class=\"wgeditfield\" id=\"{1}\" name=\"{1}\">", strHeight, cell.CellClientId); } else { sb.Append("<table class=\"wgmanytomany\"><tr><td>"); m_Rowcounter = RecordsPerRow; } RenderDetailTree(sb, null, 0, cell); sb.Append(ManyToManyType == ManyToManyType.Multiselect ? "</select>" : "</tr></table>"); } string displayText = sb.ToString(); if (string.IsNullOrEmpty(ToolTipInput) == false) { displayText = Tooltip.Add(displayText, ToolTipInput); } EditHtml(displayText, writer, cell); }
internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { if (Grid.InternalId == null) { return; } if (GridObject == null) { throw new ApplicationException( string.Format("Grid '{0}' Not found for column '{1}' in grid '{2}'", GridId, Title, Grid.Title)); } Grid.m_HasGridInsideGrid = true; GridObject.m_IsGridInsideGrid = true; GridObject.m_EventRanDoRender = false; StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); System.Web.UI.HtmlTextWriter gridwriter = new System.Web.UI.HtmlTextWriter(sw); GridObject.RenderControl(gridwriter); GridObject.m_EventRanDoRender = true; writer.Write(sb); }
internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell) { string uniqueID = cell.CellClientId; if (ChartType == ChartType.HorizontalBar) { if (m_Image == null) // Draw using table { StringBuilder bg = new StringBuilder(string.Empty); if (BackgroundImage != null) bg.AppendFormat(" background=\"{0}\"", BackgroundImage); StringBuilder s = new StringBuilder(string.Empty); s.AppendFormat("<table height=\"{0}\">", HeightEditableColumn); if (m_StartImage != null) s.AppendFormat( "<td><img alt=\"{2}\" border=\"0\" src=\"{0}\" height={1}/></td>", m_StartImage, HeightEditableColumn, Title); s.AppendFormat("<td width=\"{0}\" {1}></td>", BarWidth, bg); if (m_EndImage != null) s.AppendFormat( "<td><img alt=\"{2}\" border=\"0\" src=\"{0}\" height={1}/></td>", m_EndImage, HeightEditableColumn, Title); s.Append("</table>"); LabelHtml(s.ToString(), writer, cell); return; } else // Draw using image { StringBuilder s = new StringBuilder(string.Empty); if (m_StartImage != null) s.AppendFormat("<img alt=\"{2}\" border=\"0\" src=\"{0}\" height={1}/>", m_StartImage, HeightEditableColumn, Title); s.AppendFormat("<img alt=\"{3}\" border=\"0\" src=\"{0}\" height={1} width={2}/>", m_Image, HeightEditableColumn, BarWidth, Title); if (m_EndImage != null) s.AppendFormat("<img alt=\"{2}\" border=\"0\" src=\"{0}\" height={1}/>", m_EndImage, HeightEditableColumn, Title); LabelHtml(s.ToString(), writer, cell); return; } } if (ChartType == ChartType.HorizontalBar) { // 2005.01.09 - jorn, string optimization StringBuilder namesBuilder = new StringBuilder(); string values = string.Empty; Table t = Grid.MasterTable; for (int i = 0; i < t.Rows.Count; i++) { if (namesBuilder.Length != 0) namesBuilder.Append(","); if (values.Length != 0) values += ","; namesBuilder.Append(HttpUtility.UrlEncode(t.Rows[i][TitleColumn].Value.ToString(), Encoding.Default)); try { values += HttpUtility.UrlEncode(t.Rows[i][ValueColumn].Value.ToString().Replace(",", "."), Encoding.Default); } catch { values += "0"; } } string width = "150"; if (WidthEditableColumn.IsEmpty == false) width = WidthEditableColumn.Value.ToString(); string s = string.Format( "<img alt=\"{4}\" border=\"0\" src=\"?wgpiechart={0}&values={1}&names={2}&width={3}\"/>", uniqueID, values, namesBuilder, width, Title); LabelHtml(s, writer, cell); return; } else { ArrayList values = new ArrayList(); Table t = Grid.MasterTable; for (int i = 0; i < t.Rows.Count; i++) { double val = double.Parse(t.Rows[i][ValueColumn].Value.ToString()); string name = string.Empty; if (t.Rows[i][TitleColumn].Value != null) name = t.Rows[i][TitleColumn].Value.ToString(); ChartValue cv = new ChartValue(name, val); values.Add(cv); /* if(names != string.Empty) names += ","; if(values != string.Empty) values += ","; names += HttpUtility.UrlEncode( t.Rows[i][ TitleColumn ].Value ); try { values += HttpUtility.UrlEncode( t.Rows[i][ ValueColumn ].Value.Replace(",",".") ); } catch { values += "0"; }*/ } int width = (int)WidthEditableColumn.Value; if (width < 16) width = 150; int height = (int)HeightEditableColumn.Value; if (height < 16) height = 200; //try //{ Util.Chart c = new Util.Chart(ChartType, width, height); if (BackgroundImage != null && Grid.GotHttpContext) { if (BackgroundImage.ToUpperInvariant().StartsWith("HTTP://") == false) BackgroundImage = HttpContext.Current.Server.MapPath(BackgroundImage); c.ChartBackground = new ChartBackground(BackgroundImage); } c.ShowPieValues = false; c.ChartHeadline.Headline = Title; c.AddDataArray(values); c.RenderLabelBoard = TitleBoardOnChart; if (Grid.GotHttpContext) HttpContext.Current.Session[string.Format("{0}_{1}_img", Grid.ClientID, uniqueID)] = c.Render(); string s; //src=\"?wgchart=" + this.Grid.ColumnId + "_" + this.FormElementName + "_img\" if (Grid.GotHttpContext && HttpContext.Current.Request.Browser.Type.ToUpperInvariant().StartsWith("IE")) s = string.Format( "<img height=\"{0}\" width=\"{1}\" src=\"{2}\" style=\"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='?wgchart={3}_{4}_img', sizingMethod='scale');\" alt=\"{5}\" border=\"0\" />", Unit.Pixel(height), Unit.Pixel(width), Grid.Page.ClientScript.GetWebResourceUrl(Grid.GetType(), "WebGrid.Resources.images.transparent.gif"), Grid.ClientID, uniqueID, Title); else { s = string.Format("<img alt=\"{2}\" border=\"0\" src=\"?wgchart={0}_{1}_img\"/>", Grid.ClientID, uniqueID, Title); } LabelHtml(s, writer, cell); return; } /* else // impossible!!! { return null; }*/ }
internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { if (Identity || AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false)) { RenderLabelView(writer, cell); return; } #region Number Swap if (NumberSwap) { try { if (Grid.DisplayView == DisplayView.Detail) return; StringBuilder tmp = new StringBuilder(); string buttonup = null; string buttondown = null; int myinx = m_Table.Rows.IndexOf(cell.Row); if (myinx == -1) throw new GridException("Could not locate row"); if (myinx <= m_Table.Rows.Count - 1 && myinx != 0) { string value = m_Table.Rows[myinx - 1][ColumnId].Value != null ? m_Table.Rows[myinx - 1][ColumnId].Value.ToString() : cell.Row.RowIndex.ToString(); string myvalue = cell.Value != null ? cell.Value.ToString() : "0"; buttonup = Buttons.TextButtonControl(Grid, string.Format(@"<span title=""push row one step up"" class=""ui-icon ui-icon-triangle-1-n""/>"), "columnpushup", new[] { cell.Row.PrimaryKeyValues, m_Table.Rows[myinx - 1].PrimaryKeyValues, ColumnId, myvalue, value }, Grid.GetSystemMessageClass("UpdateRow", "wgUpdateRow")); } if (myinx != m_Table.Rows.Count - 1) { string value = m_Table.Rows[myinx + 1][ColumnId].Value != null ? m_Table.Rows[myinx + 1][ColumnId].Value.ToString() : cell.Row.RowIndex.ToString(); string myvalue = cell.Value != null ? cell.Value.ToString() : "0"; buttondown = Buttons.TextButtonControl(Grid, string.Format(@"<span title=""push row one step down"" class=""ui-icon ui-icon-triangle-1-s""/>"), "columnpushdown", new[] { cell.Row.PrimaryKeyValues, m_Table.Rows[myinx + 1].PrimaryKeyValues, ColumnId, myvalue, value }, Grid.GetSystemMessageClass("UpdateRow", "wgUpdateRow")); } if (buttonup != null && buttondown != null) tmp.AppendFormat("<table cellspacing=\"0\" cellpadding=\"0\" class=\"wgrowpush\"><tr><td>{0}</td><td>{1}</td></tr></table>", buttonup, buttondown); else if (buttonup != null) tmp.Append(buttonup); else if (buttondown != null) tmp.Append(buttondown); RenderGrid(tmp.ToString(), writer, cell); } catch (Exception ex) { throw new GridException(ex.ToString()); } return; } #endregion base.RenderEditView(writer, cell); }
internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell) { }
// 2005.01.09 - jorn - String.Compare, string.Length // 2005.01.05 - Jorn - Added check to see if there actually is a checkbox on "previous page". // Need to add a hidden field since checkbox "returns null" both for unchecked and non-existing internal void RenderDetail(bool enabled, WebGridHtmlWriter writer, RowCell cell) { if (AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false)) { enabled = false; } string uniqueId = cell.CellClientId; string strValue = DisplayText(cell); const string checkedValue = TrueValue; const string uncheckedValue = FalseValue; StringBuilder sb; if (String.Compare(strValue, checkedValue, true) == 0 && CheckedAlias != null && enabled == false) { sb = new StringBuilder(CheckedAlias); } else if (String.Compare(strValue, uncheckedValue, true) == 0 && UncheckedAlias != null && enabled == false) { sb = new StringBuilder(UncheckedAlias); } else { string bitchecked = string.Empty; string bitEnabled = string.Empty; if (String.Compare(strValue, checkedValue, true) == 0) { bitchecked = " checked=\"checked\""; } if (enabled == false) { bitEnabled = " disabled=\"disabled\""; } StringBuilder javascript = new StringBuilder(string.Empty); StringBuilder onblur = new StringBuilder(" onblur=\""); if (Grid.InputHighLight != Color.Empty) { javascript.AppendFormat( " onfocus=\"this.accessKey = this.style.backgroundColor;this.style.backgroundColor='{0}';\"", Grid.ColorToHtml(Grid.InputHighLight)); onblur.Append("this.style.backgroundColor=this.accessKey;"); } if (Grid.ColumnChangedColour != Color.Empty) { onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(Grid.ColumnChangedColour)); } onblur.Append("\""); if (AutoPostback || string.IsNullOrEmpty(ConfirmMessage) == false) { StringBuilder eventScript = new StringBuilder(" onclick=\""); if (string.IsNullOrEmpty(ConfirmMessage) == false) { eventScript.AppendFormat(" if(wgconfirm('{0}',this,'{1}')) ", ConfirmMessage.Replace("'", "\\'"), Grid.DialogTitle.Replace("'", "\\'")); } string link = Grid.EnableCallBack && !ForcePostBack?Asynchronous.GetCallbackEventReference(Grid, string.Format("ElementPostBack!{0}!{1}", ColumnId, cell.Row.PrimaryKeyValues), false, string.Empty, string.Empty) : Grid.Page.ClientScript.GetPostBackEventReference(Grid, string.Format( "ElementPostBack!{0}!{1}", ColumnId, cell.Row.PrimaryKeyValues)); eventScript.AppendFormat("{0}\"", link); javascript.Append(eventScript); } javascript.Append(onblur); sb = new StringBuilder( string.Format( "<input {0} type=\"checkbox\" {1} {2} {4} id=\"cb_{3}\" name=\"{3}\" value=\"1\"/>", javascript, bitchecked, bitEnabled, uniqueId, Attributes)); if (string.IsNullOrEmpty(m_Displaylabel) == false) { sb.AppendFormat( "<label class=\"wglabel\" id=\"label_{0}\" for=\"cb_{0}\">{1}</label>", uniqueId, m_Displaylabel); } if (enabled) { writer.Write("<input type=\"hidden\" id=\"{0}_cb\" name=\"{0}_cb\" value=\"{1}\" />", uniqueId, checkedValue); } } if (string.IsNullOrEmpty(ToolTipInput) == false) { sb = new StringBuilder(Tooltip.Add(sb.ToString(), ToolTipInput)); } EditHtml(sb.ToString(), writer, cell); }
internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { if (Identity || AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false)) { RenderLabelView(writer, cell); return; } if (Sum != null && cell.Row.RowType == RowType.DataRow) { decimal? unusedVar = GetSum(cell); } base.RenderEditView(writer, cell); }
internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { RenderLabelView(writer, cell); }
internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell) { LabelHtml("many-to-many column is not supported in grid view.", writer, cell); }
internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { if (Identity || AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false)) { RenderLabelView(writer, cell); return; } #region Number Swap if (NumberSwap) { try { if (Grid.DisplayView == DisplayView.Detail) { return; } StringBuilder tmp = new StringBuilder(); string buttonup = null; string buttondown = null; int myinx = m_Table.Rows.IndexOf(cell.Row); if (myinx == -1) { throw new GridException("Could not locate row"); } if (myinx <= m_Table.Rows.Count - 1 && myinx != 0) { string value = m_Table.Rows[myinx - 1][ColumnId].Value != null ? m_Table.Rows[myinx - 1][ColumnId].Value.ToString() : cell.Row.RowIndex.ToString(); string myvalue = cell.Value != null?cell.Value.ToString() : "0"; buttonup = Buttons.TextButtonControl(Grid, string.Format(@"<span title=""push row one step up"" class=""ui-icon ui-icon-triangle-1-n""/>"), "columnpushup", new[] { cell.Row.PrimaryKeyValues, m_Table.Rows[myinx - 1].PrimaryKeyValues, ColumnId, myvalue, value }, Grid.GetSystemMessageClass("UpdateRow", "wgUpdateRow")); } if (myinx != m_Table.Rows.Count - 1) { string value = m_Table.Rows[myinx + 1][ColumnId].Value != null ? m_Table.Rows[myinx + 1][ColumnId].Value.ToString() : cell.Row.RowIndex.ToString(); string myvalue = cell.Value != null?cell.Value.ToString() : "0"; buttondown = Buttons.TextButtonControl(Grid, string.Format(@"<span title=""push row one step down"" class=""ui-icon ui-icon-triangle-1-s""/>"), "columnpushdown", new[] { cell.Row.PrimaryKeyValues, m_Table.Rows[myinx + 1].PrimaryKeyValues, ColumnId, myvalue, value }, Grid.GetSystemMessageClass("UpdateRow", "wgUpdateRow")); } if (buttonup != null && buttondown != null) { tmp.AppendFormat("<table cellspacing=\"0\" cellpadding=\"0\" class=\"wgrowpush\"><tr><td>{0}</td><td>{1}</td></tr></table>", buttonup, buttondown); } else if (buttonup != null) { tmp.Append(buttonup); } else if (buttondown != null) { tmp.Append(buttondown); } RenderGrid(tmp.ToString(), writer, cell); } catch (Exception ex) { throw new GridException(ex.ToString()); } return; } #endregion base.RenderEditView(writer, cell); }
// 2005.01.09 - jorn, string optimize, String.Compare internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { if (AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false)) { RenderLabelView(writer, cell); return; } base.RenderEditView(writer, cell); if (DisplayCalendar && Grid.GotHttpContext) Grid.AddClientScript(writer, string.Format(calendarsetup, cell.CellClientId, CalendarFormat, AddCalendarClientAttributes, Grid.Page.ClientScript.GetWebResourceUrl(Grid.GetType(), "WebGrid.Resources.images.calendar.gif"))); }
internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { if (AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false) || !Grid.GotHttpContext) { RenderLabelView(writer, cell); return; } StringBuilder s = new StringBuilder(string.Empty); StringBuilder javascript = new StringBuilder(string.Empty); s.Append(FileSource(false, cell)); StringBuilder onblur = new StringBuilder(" onblur=\""); if (Grid.InputHighLight != Color.Empty) { javascript.AppendFormat( " onfocus=\"accessKey = style.backgroundColor;style.backgroundColor='{0}';\"", Grid.ColorToHtml(Grid.InputHighLight)); onblur.Append("style.backgroundColor=accessKey;"); } if (Grid.ColumnChangedColour != Color.Empty) { onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(Grid.ColumnChangedColour)); } onblur.Append("\""); javascript.Append(onblur); s.AppendFormat("<br/><input {0} {2} type=\"file\" class=\"wgeditfield\" name=\"{1}\" id=\"{1}\"/>", javascript, cell.CellClientId, Attributes); if (AllowEmpty && Required == false && Grid.InternalId != null && ((cell.Value != null) || (FileNameColumn != null && (cell.Value != null)))) s.AppendFormat( "<br/><input class=\"wglinkfield\" name=\"{0}_delete\" id=\"{0}_delete\" value=\"TRUE\" type=\"checkbox\" /><label class=\"wgnowrap wglabel\" id=\"label_{0}\" for=\"{0}_delete\">{1}</label>", cell.CellClientId, Grid.GetSystemMessage("RemoveImage")); if (Grid.FindForm != null) { if (Grid.EnableCallBack) { if (Grid.FindForm.Enctype.Equals("multipart/form-data", StringComparison.OrdinalIgnoreCase) == false) Manager.AddScriptForClientSideEval(string.Format("document.getElementById(\"{0}\").encoding = \"multipart/form-data\";", Grid.FindForm.ClientID)); } else Grid.FindForm.Enctype = "multipart/form-data"; } else throw new GridException( string.Format("HtmlForm is not found for grid '{0}' and column '{1}'", Grid.ID, ColumnId)); if (string.IsNullOrEmpty(ToolTipInput) == false) s = new StringBuilder(Tooltip.Add(s.ToString(), ToolTipInput)); EditHtml(s.ToString(), writer, cell); }
private void ApplyInternalValues(RowCell cell, Control ctrl) { foreach (Control control in ctrl.Controls) { if (control is LiteralControl == false) { continue; } LiteralControl ctr = control as LiteralControl; if (ctr == null) { continue; } string innerhtml = ctr.Text; if (!string.IsNullOrEmpty(innerhtml) && innerhtml.IndexOf(string.Format("[{0}]", ColumnId), StringComparison.OrdinalIgnoreCase) != -1) { throw new GridException( string.Format("The template '{0}' can't contain reference to itself.", ColumnId)); } if (string.IsNullOrEmpty(innerhtml) || !innerhtml.Contains("[")) { continue; } string content = innerhtml; cell.Row.Columns.ForEach(delegate(Column column) { if ( content.IndexOf(string.Format("[{0}]", column.ColumnId), StringComparison.OrdinalIgnoreCase) == -1) { return; } WebGridHtmlWriter writer = new WebGridHtmlWriter(Grid); Visibility columnvisibility = column.Visibility; column.Visibility = Visibility; column.SystemMessageStyle = SystemMessageStyle.WebGrid; if (Grid.Trace.IsTracing) { Grid.Trace.Trace( "Rendering ColumnName: {0} in column: {1}", column.ColumnId, ColumnId); } column.RenderEditView(writer, cell.Row.Cells[column.ColumnId]); column.Visibility = columnvisibility; if (column.AllowEdit) { writer.Write( "<input type=\"hidden\" value=\"validate\" name=\"{0}_{1}_validate\" />", Grid.ClientID, column.ColumnId); } content = content.Replace(string.Format("[{0}]", column.ColumnId), writer.ToString()); }); ((LiteralControl)control).Text = content; } }
internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { if (AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false) || !Grid.GotHttpContext) { RenderLabelView(writer, cell); return; } StringBuilder s = new StringBuilder(string.Empty); StringBuilder javascript = new StringBuilder(string.Empty); s.Append(FileSource(false, cell)); StringBuilder onblur = new StringBuilder(" onblur=\""); if (Grid.InputHighLight != Color.Empty) { javascript.AppendFormat( " onfocus=\"accessKey = style.backgroundColor;style.backgroundColor='{0}';\"", Grid.ColorToHtml(Grid.InputHighLight)); onblur.Append("style.backgroundColor=accessKey;"); } if (Grid.ColumnChangedColour != Color.Empty) { onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(Grid.ColumnChangedColour)); } onblur.Append("\""); javascript.Append(onblur); s.AppendFormat("<br/><input {0} {2} type=\"file\" class=\"wgeditfield\" name=\"{1}\" id=\"{1}\"/>", javascript, cell.CellClientId, Attributes); if (AllowEmpty && Required == false && Grid.InternalId != null && ((cell.Value != null) || (FileNameColumn != null && (cell.Value != null)))) { s.AppendFormat( "<br/><input class=\"wglinkfield\" name=\"{0}_delete\" id=\"{0}_delete\" value=\"TRUE\" type=\"checkbox\" /><label class=\"wgnowrap wglabel\" id=\"label_{0}\" for=\"{0}_delete\">{1}</label>", cell.CellClientId, Grid.GetSystemMessage("RemoveImage")); } if (Grid.FindForm != null) { if (Grid.EnableCallBack) { if (Grid.FindForm.Enctype.Equals("multipart/form-data", StringComparison.OrdinalIgnoreCase) == false) { Manager.AddScriptForClientSideEval(string.Format("document.getElementById(\"{0}\").encoding = \"multipart/form-data\";", Grid.FindForm.ClientID)); } } else { Grid.FindForm.Enctype = "multipart/form-data"; } } else { throw new GridException( string.Format("HtmlForm is not found for grid '{0}' and column '{1}'", Grid.ID, ColumnId)); } if (string.IsNullOrEmpty(ToolTipInput) == false) { s = new StringBuilder(Tooltip.Add(s.ToString(), ToolTipInput)); } EditHtml(s.ToString(), writer, cell); }
// string optimize internal override void RenderLabelView(WebGridHtmlWriter writer,RowCell cell) { string s = Value(cell); if (IsUrl && string.IsNullOrEmpty(s) == false && s.Length > 0) { //if( s.ToLowerInvariant() .StartsWith("http") == false ) if (String.Compare(s, 0, "http", 0, 4, true) != 0) s = HTTPCONST + s; s = ColumnGridAlias != null ? string.Format( "<a class=\"wglinkfield\" href=\"{0}\" target=\"_blank\">{1}</a>", s, ColumnGridAlias) : string.Format("<a class=\"wglinkfield\" href=\"{0}\" target=\"_blank\">{1}</a>", s, s); } if (IsEmail && !string.IsNullOrEmpty(s)) s = ColumnGridAlias != null ? string.Format( "<a class=\"wglinkfield\" href=\"mailto:{0}\">{1}</a>", s, ColumnGridAlias) : string.Format("<a class=\"wglinkfield\" href=\"mailto:{0}\" >{1}</a>",s, s); if (IsPassword && PasswordString != null) s = PasswordString; cell.Value = s; base.RenderLabelView(writer,cell); }
internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell) { m_IsFormElement = false; RenderDetail(false, writer, cell); }
internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell) { if (cell == null) { return; } switch (SystemColumnType) { case Enums.SystemColumn.PagerColumn: if (Grid.RecordCount > Grid.PageSize) { return; } cell.Row.m_Table.m_Grid.PagerSettings.SliderOperation = System.Web.UI.WebControls.Orientation.Vertical; writer.Write(cell.Row.m_Table.m_Grid.PagerSettings.GetPager); cell.Row.m_Table.m_Grid.PagerSettings.PagerType = PagerType.None; break; case Enums.SystemColumn.SelectColumn: writer.Write( SelectableRows.GetItemCheckbox(Grid, cell.Row.PrimaryKeyValues, string.Empty, Grid.ColorToHtml(Grid.SelectRowColor))); break; case Enums.SystemColumn.DeleteColumn: if (cell.Row.AllowDelete == false) { Visibility = Visibility.None; Title = null; } else { string strConfirmDelete = Grid.GetSystemMessage("ConfirmDelete"); if (Html == null) { writer.Write(Buttons.Anchor(Grid, " ", "RecordDeleteClick", new[] { cell.Row.PrimaryKeyValues }, strConfirmDelete, Grid.GetSystemMessage("DeleteRow"), "ui-icon ui-icon-trash", null, false)); } else { writer.Write( Buttons.TextButtonControl(Grid, Html, "RecordDeleteClick", new[] { cell.Row.PrimaryKeyValues }, null, strConfirmDelete)); } } break; case Enums.SystemColumn.SpacingColumn: WidthColumnHeaderTitle = System.Web.UI.WebControls.Unit.Empty; writer.Write(" "); break; case Enums.SystemColumn.CopyColumn: if (cell.Row.AllowCopy == false) { Visibility = Visibility.None; Title = null; } else { const string strConfirmCopy = null; if (Html == null) { writer.Write( Buttons.Anchor(Grid, " ", "RecordCopyClick", new[] { string.Empty, cell.Row.PrimaryKeyValues }, strConfirmCopy, Grid.GetSystemMessage("CopyRow"), "ui-icon ui-icon-copy", null, false)); } else { writer.Write( Buttons.TextButtonControl(Grid, Html, "RecordCopyClick", new[] { string.Empty, cell.Row.PrimaryKeyValues }, null, strConfirmCopy)); } } break; case Enums.SystemColumn.NewRecordColumn: if (Grid.AllowNew == false) { Visibility = Visibility.None; Title = null; } else { if (Html == null) { writer.Write( Buttons.TextButtonControl(Grid, Grid.GetSystemMessage("NewRecord"), "NewRecordClick", new string[] { }, Grid.GetSystemMessageClass("NewRecord", "wgnewrecord"))); } else { writer.Write( Buttons.TextButtonControl(Grid, Html, "NewRecordClick", new string[] { }, Grid.GetSystemMessageClass("NewRecord", "wgnewrecord"))); } } break; case Enums.SystemColumn.UpdateGridRecordsColumn: if (Grid.AllowUpdate == false) { Visibility = Visibility.None; Title = null; } else { if (Html == null) { writer.Write( Buttons.TextButtonControl(Grid, Grid.GetSystemMessage("UpdateRows"), "UpdateRowsClick", new string[] { }, Grid.GetSystemMessageClass("UpdateRows", "wgUpdateRows"))); } else { writer.Write( Buttons.TextButtonControl(Grid, Html, "UpdateRowsClick", new string[] { }, Grid.GetSystemMessageClass("UpdateRows", "wgUpdateRows"))); } } break; case Enums.SystemColumn.UpdateGridRecordColumn: if (Grid.AllowUpdate == false) { Visibility = Visibility.None; Title = null; } else { StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); System.Web.UI.HtmlTextWriter textwriter = new System.Web.UI.HtmlTextWriter(sw); if (Html == null) { textwriter.Write(Buttons.TextButtonControl(Grid, Grid.GetSystemMessage("UpdateRow"), "UpdateRowClick", new[] { cell.Row.PrimaryKeyValues }, Grid.GetSystemMessageClass("UpdateRow", "wgUpdateRow"))); } else { textwriter.Write(Buttons.TextButtonControl(Grid, Html, "UpdateRowClick", new[] { cell.Row.PrimaryKeyValues }, Grid.GetSystemMessageClass("UpdateRow", "wgUpdateRow"))); } writer.Write(sb); } break; } // base.RenderLabelView(writer,cell); RenderGrid(null, writer, cell); }
internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { const string s = "Graphs and charts are not supported in detail view."; EditHtml(s, writer, cell); }
internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell) { if (!string.IsNullOrEmpty(Sum) && cell.Row.RowType == RowType.DataRow) cell.Value = GetSum(cell); base.RenderLabelView(writer, cell); }
internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell) { string uniqueID = cell.CellClientId; if (ChartType == ChartType.HorizontalBar) { if (m_Image == null) // Draw using table { StringBuilder bg = new StringBuilder(string.Empty); if (BackgroundImage != null) { bg.AppendFormat(" background=\"{0}\"", BackgroundImage); } StringBuilder s = new StringBuilder(string.Empty); s.AppendFormat("<table height=\"{0}\">", HeightEditableColumn); if (m_StartImage != null) { s.AppendFormat( "<td><img alt=\"{2}\" border=\"0\" src=\"{0}\" height={1}/></td>", m_StartImage, HeightEditableColumn, Title); } s.AppendFormat("<td width=\"{0}\" {1}></td>", BarWidth, bg); if (m_EndImage != null) { s.AppendFormat( "<td><img alt=\"{2}\" border=\"0\" src=\"{0}\" height={1}/></td>", m_EndImage, HeightEditableColumn, Title); } s.Append("</table>"); LabelHtml(s.ToString(), writer, cell); return; } else // Draw using image { StringBuilder s = new StringBuilder(string.Empty); if (m_StartImage != null) { s.AppendFormat("<img alt=\"{2}\" border=\"0\" src=\"{0}\" height={1}/>", m_StartImage, HeightEditableColumn, Title); } s.AppendFormat("<img alt=\"{3}\" border=\"0\" src=\"{0}\" height={1} width={2}/>", m_Image, HeightEditableColumn, BarWidth, Title); if (m_EndImage != null) { s.AppendFormat("<img alt=\"{2}\" border=\"0\" src=\"{0}\" height={1}/>", m_EndImage, HeightEditableColumn, Title); } LabelHtml(s.ToString(), writer, cell); return; } } if (ChartType == ChartType.HorizontalBar) { // 2005.01.09 - jorn, string optimization StringBuilder namesBuilder = new StringBuilder(); string values = string.Empty; Table t = Grid.MasterTable; for (int i = 0; i < t.Rows.Count; i++) { if (namesBuilder.Length != 0) { namesBuilder.Append(","); } if (values.Length != 0) { values += ","; } namesBuilder.Append(HttpUtility.UrlEncode(t.Rows[i][TitleColumn].Value.ToString(), Encoding.Default)); try { values += HttpUtility.UrlEncode(t.Rows[i][ValueColumn].Value.ToString().Replace(",", "."), Encoding.Default); } catch { values += "0"; } } string width = "150"; if (WidthEditableColumn.IsEmpty == false) { width = WidthEditableColumn.Value.ToString(); } string s = string.Format( "<img alt=\"{4}\" border=\"0\" src=\"?wgpiechart={0}&values={1}&names={2}&width={3}\"/>", uniqueID, values, namesBuilder, width, Title); LabelHtml(s, writer, cell); return; } else { ArrayList values = new ArrayList(); Table t = Grid.MasterTable; for (int i = 0; i < t.Rows.Count; i++) { double val = double.Parse(t.Rows[i][ValueColumn].Value.ToString()); string name = string.Empty; if (t.Rows[i][TitleColumn].Value != null) { name = t.Rows[i][TitleColumn].Value.ToString(); } ChartValue cv = new ChartValue(name, val); values.Add(cv); /* if(names != string.Empty) names += ","; * if(values != string.Empty) values += ","; * names += HttpUtility.UrlEncode( t.Rows[i][ TitleColumn ].Value ); * try * { * values += HttpUtility.UrlEncode( t.Rows[i][ ValueColumn ].Value.Replace(",",".") ); * } * catch * { * values += "0"; * }*/ } int width = (int)WidthEditableColumn.Value; if (width < 16) { width = 150; } int height = (int)HeightEditableColumn.Value; if (height < 16) { height = 200; } //try //{ Util.Chart c = new Util.Chart(ChartType, width, height); if (BackgroundImage != null && Grid.GotHttpContext) { if (BackgroundImage.ToUpperInvariant().StartsWith("HTTP://") == false) { BackgroundImage = HttpContext.Current.Server.MapPath(BackgroundImage); } c.ChartBackground = new ChartBackground(BackgroundImage); } c.ShowPieValues = false; c.ChartHeadline.Headline = Title; c.AddDataArray(values); c.RenderLabelBoard = TitleBoardOnChart; if (Grid.GotHttpContext) { HttpContext.Current.Session[string.Format("{0}_{1}_img", Grid.ClientID, uniqueID)] = c.Render(); } string s; //src=\"?wgchart=" + this.Grid.ColumnId + "_" + this.FormElementName + "_img\" if (Grid.GotHttpContext && HttpContext.Current.Request.Browser.Type.ToUpperInvariant().StartsWith("IE")) { s = string.Format( "<img height=\"{0}\" width=\"{1}\" src=\"{2}\" style=\"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='?wgchart={3}_{4}_img', sizingMethod='scale');\" alt=\"{5}\" border=\"0\" />", Unit.Pixel(height), Unit.Pixel(width), Grid.Page.ClientScript.GetWebResourceUrl(Grid.GetType(), "WebGrid.Resources.images.transparent.gif"), Grid.ClientID, uniqueID, Title); } else { s = string.Format("<img alt=\"{2}\" border=\"0\" src=\"?wgchart={0}_{1}_img\"/>", Grid.ClientID, uniqueID, Title); } LabelHtml(s, writer, cell); return; } /* * else // impossible!!! * { * return null; * }*/ }
internal override void RenderEditView(WebGridHtmlWriter writer, RowCell cell) { if (Identity || AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false)) { RenderLabelView(writer, cell); return; } string uniqueID = cell.CellClientId; GetColumnPostBackData(cell); if (IsHtml) { EditHtml( !Grid.IsDesignTime ? DrawHtml(uniqueID, writer, Grid, cell) : HttpUtility.HtmlEncode("<HTML EDITOR DESIGN TIME>"), writer, cell); return; } string s; string theValueToShow = DisplayText(cell); /*if(TheValueToShow == null) * TheValueToShow = Value;*/ if (IsUrl && string.IsNullOrEmpty(theValueToShow)) { theValueToShow = HTTPCONST; } StringBuilder cssstyle = new StringBuilder("style=\""); theValueToShow = HttpUtility.HtmlEncode(theValueToShow); string size = string.Empty; string type = "text"; StringBuilder javascript = new StringBuilder(string.Empty); if (WidthEditableColumn != Unit.Empty) { cssstyle.AppendFormat("width:{0}; ", WidthEditableColumn); } if (HeightEditableColumn != Unit.Empty) { cssstyle.AppendFormat("height:{0}; ", HeightEditableColumn); } if (MaxSize > 0) { size = string.Format("maxlength=\"{0}\" ", MaxSize); } if (IsPassword) { type = "password"; } StringBuilder onblur = new StringBuilder(" onblur=\""); if (Grid.InputHighLight != Color.Empty) { javascript.AppendFormat( " onfocus=\"this.accessKey = style.backgroundColor;style.backgroundColor='{0}';\"", Grid.ColorToHtml(Grid.InputHighLight)); onblur.Append("style.backgroundColor=this.accessKey;"); } if (Grid.ColumnChangedColour != Color.Empty) { onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(Grid.ColumnChangedColour)); } if (AutoPostback) { onblur.Append("if(hasChanged(this))"); onblur.Append(Grid.EnableCallBack && !ForcePostBack ? Asynchronous.GetCallbackEventReference(Grid, string.Format("ElementPostBack!{0}!{1}", ColumnId, cell.Row.PrimaryKeyValues), false, string.Empty, string.Empty) : Grid.Page.ClientScript.GetPostBackEventReference(Grid, string.Format( "ElementPostBack!{0}!{1}", ColumnId, cell.Row.PrimaryKeyValues))); } onblur.Append("\""); javascript.Append(onblur); string mask = null; if (!DisableMaskedInput && GenerateColumnMask != null) { string maskId = string.Format("{0}_{1}", Grid.ID, ColumnId); if (!Grid.MaskedColumns.ContainsKey(maskId)) { Grid.MaskedColumns.Add(maskId, GenerateColumnMask); } mask = string.Format(" alt=\"{0}\"", maskId); } cssstyle.Append("\""); if (HeightEditableColumn == Unit.Empty) { s = string.Format( "<input {0} {1} {6}{7} type=\"{2}\" class=\"wgeditfield\" {3} value=\"{4}\" id=\"{5}\" name=\"{5}\"/>", javascript, cssstyle, type, size, theValueToShow, uniqueID, Attributes, mask); } else { s = string.Format( "<textarea rows=\"1\" cols=\"1\" {0} {1} class=\"wgeditfield\" id=\"{2}\" name=\"{3}\" {4}>", javascript, cssstyle, uniqueID, uniqueID, Attributes); if (theValueToShow != null) { s += theValueToShow; } s += "</textarea>"; } if (string.IsNullOrEmpty(ToolTipInput) == false) { s = Tooltip.Add(s, ToolTipInput); } EditHtml(s, writer, cell); }
internal override void RenderEditView(WebGridHtmlWriter writer,RowCell cell) { if (Grid.InternalId == null) return; if (GridObject == null) throw new ApplicationException( string.Format("Grid '{0}' Not found for column '{1}' in grid '{2}'", GridId, Title, Grid.Title)); Grid.m_HasGridInsideGrid = true; GridObject.m_IsGridInsideGrid = true; GridObject.m_EventRanDoRender = false; StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); System.Web.UI.HtmlTextWriter gridwriter = new System.Web.UI.HtmlTextWriter(sw); GridObject.RenderControl(gridwriter); GridObject.m_EventRanDoRender = true; writer.Write(sb); }
internal override void RenderEditView(WebGridHtmlWriter writer,RowCell cell) { if (Identity || AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false)) { RenderLabelView(writer,cell); return; } string uniqueID = cell.CellClientId; GetColumnPostBackData(cell); if (IsHtml) { EditHtml( !Grid.IsDesignTime ? DrawHtml(uniqueID, writer, Grid, cell) : HttpUtility.HtmlEncode("<HTML EDITOR DESIGN TIME>"), writer, cell); return; } string s; string theValueToShow = DisplayText(cell); /*if(TheValueToShow == null) TheValueToShow = Value;*/ if (IsUrl && string.IsNullOrEmpty(theValueToShow)) theValueToShow = HTTPCONST; StringBuilder cssstyle = new StringBuilder("style=\""); theValueToShow = HttpUtility.HtmlEncode(theValueToShow); string size = string.Empty; string type = "text"; StringBuilder javascript = new StringBuilder(string.Empty); if (WidthEditableColumn != Unit.Empty) cssstyle.AppendFormat("width:{0}; ", WidthEditableColumn); if (HeightEditableColumn != Unit.Empty) cssstyle.AppendFormat("height:{0}; ", HeightEditableColumn); if (MaxSize > 0) size = string.Format("maxlength=\"{0}\" ", MaxSize); if (IsPassword) type = "password"; StringBuilder onblur = new StringBuilder(" onblur=\""); if (Grid.InputHighLight != Color.Empty) { javascript.AppendFormat( " onfocus=\"this.accessKey = style.backgroundColor;style.backgroundColor='{0}';\"", Grid.ColorToHtml(Grid.InputHighLight)); onblur.Append("style.backgroundColor=this.accessKey;"); } if (Grid.ColumnChangedColour != Color.Empty) onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(Grid.ColumnChangedColour)); if (AutoPostback) { onblur.Append("if(hasChanged(this))"); onblur.Append(Grid.EnableCallBack && !ForcePostBack ? Asynchronous.GetCallbackEventReference(Grid, string.Format("ElementPostBack!{0}!{1}", ColumnId, cell.Row.PrimaryKeyValues), false, string.Empty, string.Empty) : Grid.Page.ClientScript.GetPostBackEventReference(Grid, string.Format( "ElementPostBack!{0}!{1}", ColumnId, cell.Row.PrimaryKeyValues))); } onblur.Append("\""); javascript.Append(onblur); string mask = null; if (!DisableMaskedInput && GenerateColumnMask != null) { string maskId = string.Format("{0}_{1}", Grid.ID, ColumnId); if (!Grid.MaskedColumns.ContainsKey(maskId)) Grid.MaskedColumns.Add(maskId, GenerateColumnMask); mask = string.Format(" alt=\"{0}\"", maskId); } cssstyle.Append("\""); if (HeightEditableColumn == Unit.Empty) { s = string.Format( "<input {0} {1} {6}{7} type=\"{2}\" class=\"wgeditfield\" {3} value=\"{4}\" id=\"{5}\" name=\"{5}\"/>", javascript, cssstyle, type, size, theValueToShow, uniqueID, Attributes,mask); } else { s = string.Format( "<textarea rows=\"1\" cols=\"1\" {0} {1} class=\"wgeditfield\" id=\"{2}\" name=\"{3}\" {4}>", javascript, cssstyle, uniqueID, uniqueID, Attributes); if (theValueToShow != null) s += theValueToShow; s += "</textarea>"; } if (string.IsNullOrEmpty(ToolTipInput) == false) s = Tooltip.Add(s, ToolTipInput); EditHtml(s, writer,cell); }
internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell) { string image = FileSource(true, cell); if (!string.IsNullOrEmpty(PopupImageColumn)) { if (!cell.Row.Columns.Contains(PopupImageColumn)) { throw new ApplicationException( string.Format(@"""PopupImageColumn"" property value for column '{0}' is not valid.", Title)); } string rel = ""; if (m_PopupImageDisplayType == ImageDisplayType.Navigation || m_PopupImageDisplayType == ImageDisplayType.NavigationSlideShow) { rel = string.Format("rel=\"{0}_{1}\"", Grid.ClientID, ColumnId); } image = string.Format(@"<a href=""{1}"" title=""{3}"" {4} class=""wgimage_{5}""><img class=""wgimage"" src=""{0}"" alt=""{2}""/></a>", image, ((Image)cell.Row.Columns[PopupImageColumn]).GetUrl(cell.Row[PopupImageColumn]), Title, PopupImageCaption, rel, ColumnId); switch (PopupImageDisplayType) { case ImageDisplayType.Navigation: Grid.AddClientScript(writer, string.Format("$(\"a[rel='{0}_{1}']\").colorbox({{slideshow:false}});", Grid.ClientID, ColumnId)); break; case ImageDisplayType.NavigationSlideShow: Grid.AddClientScript(writer, string.Format("$(\"a[rel='{0}_{1}']\").colorbox({{slideshow:true}});", Grid.ClientID, ColumnId)); break; case ImageDisplayType.Single: Grid.AddClientScript(writer, string.Format("$(document).ready(function() {{$(\".wgimage_{0}\").colorbox();}});", ColumnId)); break; } } else { image = string.Format(@"<img class=""wgimage"" src=""{0}"" alt=""{1}""/>", image, Title); } if (HyperLinkColumn && Grid.DisplayView == DisplayView.Grid) { string a = Grid.EnableCallBack ? Asynchronous.GetCallbackEventReference(Grid, string.Format("RecordClick!{0}!{1}", ColumnId, cell.Row.PrimaryKeyValues), false, string.Empty, string.Empty) : Grid.Page.ClientScript.GetPostBackEventReference(Grid, string.Format("RecordClick!{0}!{1}", ColumnId, cell.Row. PrimaryKeyValues)); string b = (String.IsNullOrEmpty(ConfirmMessage)) ? string.Empty : String.Format("if(wgconfirm('{0}',this,'{1}')) ", ConfirmMessage.Replace("'", "\\'"), Grid.DialogTitle.Replace("'", "\\'")); image = string.Format( "<a class=\"wglinkfield\" href=\"#\" onclick=\"{0}{1}\">{2}</a>", b, a, image); } LabelHtml(image, writer, cell); }
internal string DrawHtml(string uniqueID, WebGridHtmlWriter writer, Grid grid,RowCell cell) { string theValueToShow = Value(cell); HtmlEditor e = new HtmlEditor { ID = uniqueID, ImagePath = Grid.ImagePath, UserBRonCarriageReturn = true, Width = (WidthEditableColumn != Unit.Empty ? WidthEditableColumn : 500), Height = (HeightEditableColumn != Unit.Empty ? HeightEditableColumn : 400), Text = theValueToShow }; e.ImagePath = GridConfig.Get("WGEditorImagePath", grid.ImagePath); StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); System.Web.UI.HtmlTextWriter mywriter = new System.Web.UI.HtmlTextWriter(sw); e.RenderControl(mywriter); mywriter.Flush(); mywriter.Close(); return sb.ToString(); }