private void AddIframe(string embedUrl, string iframeFormat) { TableGrid table = null; Control parent = lblDescription.Parent; while (parent != null) { table = parent as TableGrid; if (table != null) { break; } else { parent = parent.Parent; } } if (table != null) { TableGridRow row = new TableGridRow(); TableGridColumn column = new TableGridColumn(); Label label = new Label(); label.Text = string.Format(CultureInfo.InvariantCulture, iframeFormat, embedUrl); column.Controls.Add(label); row.Cells.Add(column); table.Rows.Add(row); } }
private void AddCustomCell(TableGridRow row, TableGridColumn.FormType formType, string idPrefix, string propertyName, string text) { TableGridColumn column = new TableGridColumn(); column.ColumnType = formType; Label label = new Label(); label.ID = idPrefix + propertyName; label.Text = Server.HtmlEncode(text); column.Controls.Add(label); row.Cells.Add(column); }
private void AddCustomUrlCell(TableGridRow row, TableGridColumn.FormType formType, string idPrefix, string propertyName, string text) { TableGridColumn column = new TableGridColumn(); column.ColumnType = formType; if (string.IsNullOrEmpty(text) == false) { HyperLink link = new HyperLink(); link.ID = idPrefix + propertyName; link.Text = Server.HtmlEncode(text); try { link.NavigateUrl = Uri.EscapeUriString(text); } catch (UriFormatException) { // Invalid url } column.Controls.Add(link); } row.Cells.Add(column); }