private void DrawKenGrid(Grid kenGrid) { container.Controls.Clear(); Table tbl = new Table(); container.Controls.Add(tbl); for (int i = 0; i < kenGrid.Dimension; i++) { TableRow row = new TableRow(); tbl.Rows.Add(row); for (int j = 0; j < kenGrid.Dimension; j++) { CellViewModel cellView = new CellViewModel(kenGrid.CellMatrix[i, j]); TableCell cell = new TableCell(); DefineBorder(cell, cellView); row.Cells.Add(cell); KenCell kenCell = (KenCell)LoadControl("KenCell.ascx"); kenCell.ID = "kencell-" + i.ToString() + "-" + j.ToString(); kenCell.Cell = cellView; cell.Controls.Add(kenCell); } } }
/// <summary> /// 排序事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { Int32 DataIDX = 0; TableCell cell = null; if (e.Row.RowType == DataControlRowType.Header) { #region 单选框 cell = new TableCell(); cell.Width = Unit.Pixel(5); cell.Text = " "; e.Row.Cells.AddAt(0, cell); #endregion } else { //增加行选项 DataIDX = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "ID")); cell = new TableCell(); cell.Width = Unit.Pixel(5); cell.Text = string.Format(" <input name='RadioButton' id='RadioButton' value='{0}' type='radio' />", DataIDX); e.Row.Cells.AddAt(0, cell); } }
public void create_request_table(string stg1, string stg2) { TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = "<h4 class = 'font-thai font-1d8'>" + stg1 + "</h4>"; row.Cells.Add(cell1); cell1 = new TableCell(); cell1.Text = "<h4 class = 'font-thai font-1d8'>" + stg2 + "</h4>"; row.Cells.Add(cell1); cell1 = new TableCell(); Button bt = new Button(); bt.CssClass = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"; bt.Text = "ยืนยัน"; bt.Click += delegate { teacher_delete(stg1); }; cell1.Controls.Add(bt); bt = new Button(); bt.CssClass = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored"; bt.Text = "ดู"; cell1.Controls.Add(bt); bt = new Button(); bt.CssClass = "mdl-button mdl-js-button mdl-button--accent"; bt.Text = "ไม่ยืนยัน"; bt.Click += delegate { teacher_delete(stg1); }; cell1.Controls.Add(bt); row.Cells.Add(cell1); request_view_table.Rows.Add(row); }
protected override void CreateChildControls() { PopupBGIButton ok = new PopupBGIButton(); ok.Text = GetButton("OK"); ok.Name = "OK"; ok.CssClass += " " + "ajax__htmleditor_popup_confirmbutton "; PopupBGIButton cancel = new PopupBGIButton(); cancel.Text = GetButton("Cancel"); cancel.Name = "Cancel"; cancel.CssClass += " " + "ajax__htmleditor_popup_confirmbutton"; Table table = new Table(); table.Attributes.Add("border", "0"); table.Attributes.Add("cellspacing", "0"); table.Attributes.Add("cellpadding", "0"); table.Style["width"] = "100%"; TableRow row = new TableRow(); table.Rows.Add(row); TableCell cell = new TableCell(); row.Cells.Add(cell); cell.HorizontalAlign = HorizontalAlign.Right; cell.Controls.Add(ok); cell.Controls.Add(cancel); Content.Add(table); RegisteredHandlers.Add(new RegisteredField("OK", ok)); RegisteredHandlers.Add(new RegisteredField("Cancel", cancel)); base.CreateChildControls(); }
protected void Page_Load(object sender, EventArgs e) { p = (Person)Session["Person"]; if (p != null) { itemTable.Visible = false; Label2.Visible = false; personTable.Visible = false; Label3.Visible = false; foreach (ShoppingList sl in p.shoppingLists) { Button b = new Button(); TableRow row = new TableRow(); TableCell liste = new TableCell(); b.ID = sl.ShoppingListNumber.ToString(); b.Text = sl.Title; b.Click += ItemButton_Click; liste.Controls.Add(b); row.Cells.Add(liste); listTable.Rows.Add(row); } } else { Label1.Text = "Log venligst ind"; } }
private void BuildAlphaIndex() { string[] alphabet = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}; TableRow row = new TableRow(); TableCell cell = null; LinkButton lkbtn = null; for (int i = 0; i < alphabet.Length - 1; i++) { cell = new TableCell(); lkbtn = new LinkButton(); lkbtn.Text = alphabet[i].ToString(); lkbtn.Font.Underline = true; lkbtn.Font.Size = 15; lkbtn.PostBackUrl = string.Format("IndexView.aspx?Page={0}", alphabet[i].ToString()); cell.Controls.Add(lkbtn); row.Cells.Add(cell); cell = new TableCell(); cell.Text = string.Empty; row.Cells.Add(cell); cell = new TableCell(); cell.Text = string.Empty; row.Cells.Add(cell); } tblAZ.Rows.Add(row); }
public void AddRange (TableCell[] cells) { foreach (TableCell td in cells) { if (cc.IndexOf (td) < 0) cc.Add (td); } }
protected void upload_button_click(object sender, EventArgs e) { if (file_upload_control.HasFile) { try { UploadedFile uf = new UploadedFile(file_upload_control.PostedFile); foreach (PropertyInfo info in uf.GetType().GetProperties()) { TableRow row = new TableRow(); TableCell[] cells = new TableCell[] {new TableCell(),new TableCell(),new TableCell()}; cells[0].Controls.Add(new LiteralControl(info.PropertyType.ToString())); cells[1].Controls.Add(new LiteralControl(info.Name)); cells[2].Controls.Add(new LiteralControl(info.GetValue(uf).ToString())); row.Cells.AddRange(cells); file_upload_details_table.Rows.Add(row); } status_label.Text = "Status: OK!"; } catch (Exception ex) { status_label.Text = "Status: The file could not be uploaded. The following error occured: " + ex.Message; } } }
private void Page_Load(object sender, System.EventArgs e) { for (int month = 0; month < 2; month++) { TableCell tc = new TableCell(); tc.VerticalAlign = VerticalAlign.Top; System.Web.UI.WebControls.Calendar c = new System.Web.UI.WebControls.Calendar(); c.VisibleDate = DateTime.Today.AddMonths(month); c.DayRender += new DayRenderEventHandler(DateCal_DayRender); c.DayStyle.Width = Unit.Parse("30px"); c.DayStyle.Height = Unit.Parse("35px"); c.DayStyle.VerticalAlign = VerticalAlign.Top; c.DayStyle.CssClass = "BannerCalendarDay"; c.DayHeaderStyle.CssClass = "BannerCalendarDayHeader"; c.OtherMonthDayStyle.CssClass = "BannerCalendarOtherMonthDay"; c.CssClass = "BannerCalendar"; c.TitleStyle.CssClass = "BannerCalendarTitle"; c.CellPadding = 0; c.CellSpacing = 0; c.ShowNextPrevMonth = false; tc.Controls.Add(c); Row.Cells.Add(tc); } }
/// <summary> /// Add the error/warning message to the table /// </summary> /// <param name="url">URL of origin of the message</param> /// <param name="type">Error or warning</param> /// <param name="line">Last Line</param> /// <param name="column">Last Column</param> /// <param name="msg">Additional error/warning message</param> private void AddToTable(string url, string type, string line, string column, string msg) { var tRow = new TableRow(); var tCellUrl = new TableCell(); tCellUrl.Text = "<a href='" + url + "' target='_blank'>" + url + "</a>"; tRow.Cells.Add(tCellUrl); var tCellType = new TableCell(); tCellType.Text = type; tRow.Cells.Add(tCellType); var tCellLine = new TableCell(); tCellLine.Text = line; tRow.Cells.Add(tCellLine); var tCellClmn = new TableCell(); tCellClmn.Text = column; tRow.Cells.Add(tCellClmn); var tCellMsg = new TableCell(); tCellMsg.Text = msg; tRow.Cells.Add(tCellMsg); w3Table.Rows.Add(tRow); }
protected void Page_Load(object sender, EventArgs e) { WarningsCount.Text = SessionManager.Current.User.WarningMessages.Count.ToString(CultureInfo.InvariantCulture); if (SessionManager.Current.User.WarningMessages.Count > 0) { int rows = 0; foreach (string alert in SessionManager.Current.User.WarningMessages) { var alertRow = new TableRow(); alertRow.Attributes.Add("class", "AlertTableCell"); var component = new TableCell { Text = alert, Wrap = true }; alertRow.Cells.Add(component); WarningTable.Rows.Add(alertRow); rows++; if (rows == 5) break; } } }
private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); System.Web.UI.WebControls.Table tbl1 = new System.Web.UI.WebControls.Table(); tbl1.Rows.Add(new System.Web.UI.WebControls.TableRow()); System.Web.UI.WebControls.Table tbl = new System.Web.UI.WebControls.Table(); tbl.Rows.Add(new System.Web.UI.WebControls.TableRow()); try { base.GHTSubTestBegin("Add cells"); base.GHTActiveSubTest.Controls.Add(tbl); base.GHTActiveSubTest.Controls.Add(tbl1); // add new cell tbl1.Rows[0].Cells.Add(new System.Web.UI.WebControls.TableCell()); tbl.Rows[0].Cells.Add(new System.Web.UI.WebControls.TableCell()); System.Web.UI.WebControls.TableCell tblCell = new System.Web.UI.WebControls.TableCell(); tbl.Rows[0].Cells.Add(tblCell); // add cell from one table to another tbl.Rows[0].Cells.Add(tbl1.Rows[0].Cells[0]); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); base.GHTTestEnd(); }
/// <summary> /// New table cell (TD) with the given text content and css class /// </summary> /// <param name="content">Textual content</param> /// <param name="cssClass">CssClass to apply to the cell</param> private System.Web.UI.WebControls.TableCell newCell(string content, string cssClass) { System.Web.UI.WebControls.TableCell result = new System.Web.UI.WebControls.TableCell(); result.Text = content; result.CssClass = cssClass; return(result); }
private TableRow BuildOptionRow(string label, Control optionControl, string comment, string controlComment) { TableRow row = new TableRow(); TableCell cell = new TableCell(); TableCell cell2 = new TableCell(); cell.Wrap = false; if (label != null) { Label child = new Label(); child.ControlStyle.Font.Bold = true; child.Text = label; child.CssClass = "AnswerTextRender";//JJ cell.Controls.Add(child); cell.VerticalAlign = VerticalAlign.Top; if (comment != null) { cell.Controls.Add(new LiteralControl("<br />" + comment)); } row.Cells.Add(cell); } else { cell2.ColumnSpan = 2; } cell2.Controls.Add(optionControl); if (controlComment != null) { cell2.Controls.Add(new LiteralControl("<br />" + controlComment)); } row.Cells.Add(cell2); return row; }
private void OnItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { try { if ((e.Item.ItemType != ListItemType.Item) && (e.Item.ItemType != ListItemType.AlternatingItem)) { return; } DataRowView drv = (DataRowView)e.Item.DataItem; string strFileName = (string)drv["fileName"]; System.Web.UI.WebControls.TableCell tc = e.Item.Cells[4]; if (tc.Controls.Count > 1) { WebControl objBtn = (WebControl)tc.Controls[1]; objBtn.Attributes.Add("onclick", "return confirm(\"Are you sure you want to delete '" + strFileName + "'?\");"); objBtn.Attributes.Add("title", "Click to delete '" + strFileName + "'"); } } catch (Exception ex) { lblMsg.Visible = true; lblMsg.Text = "Error '" + ex.Message + "' occurred."; } }
public static System.IO.StringWriter CreateExcel_HTML( DataTable Dt , ClsExcel_Columns Columns) { System.IO.StringWriter Sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter Htw = new System.Web.UI.HtmlTextWriter(Sw); System.Web.UI.WebControls.Table Tb = new System.Web.UI.WebControls.Table(); System.Web.UI.WebControls.TableRow Tbr_Header = new System.Web.UI.WebControls.TableRow(); foreach (ClsExcel_Columns.Str_Columns?Obj in Columns.pObj) { System.Web.UI.WebControls.TableCell Tbc = new System.Web.UI.WebControls.TableCell(); Tbc.Text = Obj.Value.FieldDesc; Tbr_Header.Cells.Add(Tbc); } Tb.Rows.Add(Tbr_Header); foreach (DataRow Dr in Dt.Rows) { System.Web.UI.WebControls.TableRow Tbr = new System.Web.UI.WebControls.TableRow(); foreach (ClsExcel_Columns.Str_Columns?Obj in Columns.pObj) { System.Web.UI.WebControls.TableCell Tbc = new System.Web.UI.WebControls.TableCell(); Tbc.Text = Dr[Obj.Value.FieldName].ToString(); Tbr.Cells.Add(Tbc); } Tb.Rows.Add(Tbr); } Tb.RenderControl(Htw); return(Sw); }
protected void Page_Load(object sender, EventArgs e) { ctrlСклад.MasterViewName = Склад.Views.СкладL.Name; ctrlСклад.MasterTypeName = typeof(Склад).AssemblyQualifiedName; ctrlСклад.PropertyToShow = "Название"; if (Session["storagepk"] != null) { var ds = (SQLDataService)DataServiceProvider.DataService; var автомашиныPseudoDetail = new PseudoDetail<Автомашина, Поступление> (Поступление.Views.ПоступлениеE, Information.ExtractPropertyPath<Поступление>(p => p.Автомашина)); var ВладельцыАвтомашинИзПоступленийНаСклад = ds.Query<Автомашина>(Автомашина.Views.АвтомашинаE) .Where(a => автомашиныPseudoDetail.Any(s => s.Склад.__PrimaryKey.ToString() == ctrlСклад.SelectedMasterPK)).ToList() .Select(c => new { Фамилия = c.ВладелецАвтомашины.Фамилия }).Distinct(); //var ВладельцыАвтомашин = АвтомашиныИзПоступленийНаСклад.Select(o => o.ВладелецАвтомашины.Фамилия).ToList(); foreach (var Владелец in ВладельцыАвтомашинИзПоступленийНаСклад) { TableRow tr = new TableRow(); TableCell tc = new TableCell() { Text = Владелец.Фамилия }; tr.Cells.Add(tc); TableВладельцы.Rows.Add(tr); } } //WolvOwners.LimitFunction = LinqToLcs.GetLcs(АвтомашиныИзПоступленийНаСклад.Expression, //Автомашина.Views.АвтомашинаE).LimitFunction; //WolvOwners.LimitFunction = LinqToLcs.GetLcs(ВладельцыАвтомашин.ToList().AsQueryable().Expression, //Человек.Views.ЧеловекE).LimitFunction; }
private void AddThemeToTable(TblThemes theme, int i) { var row = new TableRow {ID = theme.ID.ToString()}; var number = new TableCell {Text = i.ToString(), HorizontalAlign = HorizontalAlign.Center}; var name = new TableCell {Text = theme.Name, HorizontalAlign = HorizontalAlign.Center}; var type = new TableCell {Text = theme.IsControl.ToString(), HorizontalAlign = HorizontalAlign.Center}; var pageOrder = new TableCell {HorizontalAlign = HorizontalAlign.Center}; pageOrder.Controls.Add(GetPageOrderDropDownList(theme.PageOrderRef)); var pageCountToShow = new TableCell {HorizontalAlign = HorizontalAlign.Center}; pageCountToShow.Controls.Add(GetPageCountToShowDropDownList(theme)); var maxCountToSubmit = new TableCell {HorizontalAlign = HorizontalAlign.Center}; maxCountToSubmit.Controls.Add(GetMaxCountToSubmitDropDownList(theme.MaxCountToSubmit)); var themePages = new TableCell(); themePages.Controls.Add(new HyperLink { Text = "Pages", NavigateUrl = ServerModel.Forms.BuildRedirectUrl(new ThemePagesController { BackUrl = string.Empty, ThemeId = theme.ID }) }); row.Cells.AddRange(new[] { number, name, type, pageOrder, pageCountToShow, maxCountToSubmit, themePages }); CourseBehaviorTable.Rows.Add(row); }
//辅助方法 获取每个单元格的内容 public static string GetCellText(TableCell cell) { string text = cell.Text; if (!string.IsNullOrEmpty(text)) { return text; } foreach (Control control in cell.Controls) { if (control != null && control is IButtonControl) { IButtonControl btn = control as IButtonControl; text = btn.Text.Replace("\r\n", "").Trim(); break; } if (control != null && control is ITextControl) { LiteralControl lc = control as LiteralControl; if (lc != null) { continue; } ITextControl l = control as ITextControl; text = l.Text.Replace("\r\n", "").Trim(); break; } } return text; }
public static void AddCell(this System.Web.UI.WebControls.TableRow row, string cellContents, int colSpan) { System.Web.UI.WebControls.TableCell cell = new System.Web.UI.WebControls.TableCell(); cell.Text = cellContents; cell.ColumnSpan = colSpan; row.Cells.Add(cell); }
private void Button2_Click(object sender, System.EventArgs e) { Table1.Rows.Clear(); OlapQueue q=OlapQueue.Instance; for(int i=0;i<q.Count;i++) { TableRow row=new TableRow(); Table1.Rows.Add(row); TableCell cell; cell=new TableCell(); row.Cells.Add(cell); cell.Text=q[i].ID.ToString(); cell=new TableCell(); row.Cells.Add(cell); cell.Text=q[i].Report.Name; cell=new TableCell(); row.Cells.Add(cell); cell.Text=q[i].Status.ToString(); cell=new TableCell(); row.Cells.Add(cell); cell.Text=q[i].ExecutionStarted.ToLongTimeString(); } }
public static void AddCell(this System.Web.UI.WebControls.TableRow row, string cellContents, string cssClass) { System.Web.UI.WebControls.TableCell cell = new System.Web.UI.WebControls.TableCell(); cell.Text = cellContents; cell.CssClass = cssClass; row.Cells.Add(cell); }
protected void Page_Load(object sender, EventArgs e) { var temp = new Movie(); var movies = temp.getAll(); Table table = new Table(); foreach (int moid in movies.Keys) { TableRow row = new TableRow(); TableCell imageCell = new TableCell(); Image image = new Image(); image.ImageUrl = movies[moid].read("imgurl").ToString(); HtmlAnchor anchor = new HtmlAnchor(); anchor.HRef = "/show_movie.aspx?moid=" + movies[moid].id; anchor.Controls.Add(image); imageCell.Controls.Add(anchor); row.Controls.Add(imageCell); TableCell cell = new TableCell(); cell.VerticalAlign = VerticalAlign.Top; cell.Text = "<h2>" + movies[moid].read("title").ToString() + "</h2>"; row.Controls.Add(cell); cell.Text += (movies[moid].read("description").ToString().Length > 1024) ? movies[moid].read("description").ToString().Substring(0, 1024) + "..." : movies[moid].read("description").ToString(); row.Controls.Add(cell); table.Controls.Add(row); } PlaceHolder1.Controls.Add(table); }
/// <summary> /// Must create and return the control /// that will show the administration interface /// If none is available returns null /// </summary> public Control GetAdministrationInterface(Style controlStyle) { this._adminTable = new Table(); this._adminTable.ControlStyle.CopyFrom(controlStyle); this._adminTable.Width = Unit.Percentage(100); TableCell cell = new TableCell(); TableRow row = new TableRow(); cell.ColumnSpan = 2; cell.Text = ResourceManager.GetString("NSurveySecurityAddinDescription", this.LanguageCode); row.Cells.Add(cell); this._adminTable.Rows.Add(row); cell = new TableCell(); row = new TableRow(); CheckBox child = new CheckBox(); child.Checked = new Surveys().NSurveyAllowsMultipleSubmissions(this.SurveyId); Label label = new Label(); label.ControlStyle.Font.Bold = true; label.Text = ResourceManager.GetString("MultipleSubmissionsLabel", this.LanguageCode); cell.Width = Unit.Percentage(50); cell.Controls.Add(label); row.Cells.Add(cell); cell = new TableCell(); child.CheckedChanged += new EventHandler(this.OnCheckBoxChange); child.AutoPostBack = true; cell.Controls.Add(child); Unit.Percentage(50); row.Cells.Add(cell); this._adminTable.Rows.Add(row); return this._adminTable; }
public static TableCell AddTableCell(TableRow tableRow, string value, SourceTextType fieldType, string toolTip = "") { TableCell tableCell1 = new TableCell(); string valueToPrint = "NA"; switch (fieldType) { case SourceTextType.DateTime: if (!string.IsNullOrWhiteSpace(value)) { DateTime createdDate = DateTime.Now; createdDate = DateTime.Parse(value); valueToPrint = SCBasics.AuditTrail.Utils.DateTimeUtil.TimeAgo(createdDate); } else { valueToPrint = "NA"; } break; case SourceTextType.Text: valueToPrint = !string.IsNullOrWhiteSpace(value) ? value : "NA"; break; default: valueToPrint = !string.IsNullOrWhiteSpace(value) ? value : "NA"; break; } tableCell1.Text = valueToPrint; tableCell1.ToolTip = toolTip; tableRow.Cells.Add(tableCell1); return tableCell1; }
/// <summary> /// Take a list of faults and append them into the fault table, putting hte parentProfileTitle into the appropriate column /// </summary> /// <param name="faultList">List of SafetyCheckCombinedResultsFault items</param> /// <param name="parentProfileTitle">Name of the profile to which these faults relate</param> private void appendFaultListIntoTable(List <Orchestrator.Entities.SafetyCheckCombinedResultsFault> faultList, string parentProfileTitle) { foreach (SafetyCheckCombinedResultsFault fault in faultList) { TableRow faultRow = new TableRow(); if (faultListRowCount % 2 == 1) { faultRow.CssClass = "odd"; } faultRow.TableSection = TableRowSection.TableBody; faultRow.Cells.Add(newCell(parentProfileTitle)); faultRow.Cells.Add(newCell(fault.Title)); faultRow.Cells.Add(newCell(fault.StatusTerm)); faultRow.Cells.Add(newCell(fault.Comment)); System.Web.UI.WebControls.TableCell photoCell = newCell(NON_BREAKING_SPACE_ENTITYREF); if (fault.HasPhotosYN) { photoCell = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.HyperLink viewLink = new System.Web.UI.WebControls.HyperLink(); viewLink.NavigateUrl = "javascript:openNewPopupWindow('Fault Photos','/Resource/SafetyChecks/ViewSafetyCheckFaultPhotos.aspx?scfId=" + fault.SafetyCheckFaultId + "');"; viewLink.Text = PHOTOS_VIEW_LINK_TEXT; photoCell.Controls.Add(viewLink); } faultRow.Cells.Add(photoCell); safetyCheckFaultListTable.Rows.Add(faultRow); faultListRowCount++; } }
protected void Page_Load(object sender, EventArgs e) { // Connect to the database. using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings[_connectionStringName].ToString())) { // Read from the database. var cmd = new SqlCommand(string.Format("SELECT {0} FROM {1}", string.Join(",", _columns), _databaseName), cn); cn.Open(); // Add an HTML table row for each database record. using (SqlDataReader rdr = cmd.ExecuteReader()) { while (rdr.Read()) { var row = new TableRow(); for (int column = 0; column < _columns.Length; ++column) { var cell = new TableCell(); cell.Text = rdr[column].ToString(); row.Cells.Add(cell); } Table1.Rows.Add(row); } } } }
protected override void CreateChildControls() { Table table = new Table(); for (int i = 0; i < _colors.Length; i++) { TableRow row = new TableRow(); table.Rows.Add(row); for (int j = 0; j < _colors[i].Length; j++) { TableCell cell = new TableCell(); cell.Style[HtmlTextWriterStyle.Width] = "10px"; cell.Style[HtmlTextWriterStyle.Height] = "10px"; cell.Style[HtmlTextWriterStyle.Cursor] = "pointer"; cell.Style["background-color"] = "#" + _colors[i][j]; cell.Attributes.Add("onclick", "setColor(\"#" + _colors[i][j] + "\")"); row.Cells.Add(cell); HtmlGenericControl innerDiv = new HtmlGenericControl("div"); innerDiv.Style[HtmlTextWriterStyle.Height] = "100%"; innerDiv.Style[HtmlTextWriterStyle.Width] = "100%"; innerDiv.Style["font-size"] = "1px"; cell.Controls.Add(innerDiv); } } table.Attributes.Add("border", "0"); table.Attributes.Add("cellspacing", "1"); table.Attributes.Add("cellpadding", "0"); table.Style["background-color"] = "#000000"; Content.Add(table); base.CreateChildControls(); }
private void SetSortHeaderAttributes(ASP.GridViewRowEventArgs e) { bool images = (this.AscImage != String.Empty && this.DescImage != String.Empty); for (int i = 0; i < e.Row.Cells.Count; i++) { ASP.TableCell td = e.Row.Cells[i]; if (td.HasControls()) { ASP.LinkButton button = td.Controls[0] as ASP.LinkButton; if (button != null) { if (this.SortExpression == button.CommandArgument) { td.ApplyStyle(this.SortedColumnHeaderRowStyle); this.sortColumnIndex = i; if (images) { ImageButton btn = new ImageButton(); btn.CommandName = button.CommandName; btn.CommandArgument = button.CommandArgument; btn.ImageUrl = (this.SortDirection == ASP.SortDirection.Ascending ? this.AscImage : this.DescImage); td.Controls.Add(new LiteralControl(" ")); td.Controls.Add(btn); td.Controls.Add(new LiteralControl(" ")); } } } } } }
public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType) { base.InitializeCell(cell, columnIndex, itemType); if (Enum.IsDefined(typeof(ListItemType), itemType) && itemType != ListItemType.Footer && itemType != ListItemType.Header) { WebControl toDisplay = null; if(ButtonType == ButtonColumnType.PushButton) { Button b = new Button(); b.Text = Text; b.CommandName = CommandName; b.CausesValidation = false; toDisplay = b; } else { LinkButton lb = new DataGridLinkButton(); lb.Text = Text; lb.CommandName = CommandName; lb.CausesValidation = false; toDisplay = lb; } if(DataTextField.Length > 0) { toDisplay.DataBinding += new EventHandler(OnDataBindButtonColumn); } cell.Controls.Add(toDisplay); } }
protected void ButtonQuery_Click(object sender, EventArgs e) { Table.Rows.Clear(); List<Order> allOrders = OrderService.FindOrdersByStatusAndDate(Int32.Parse(DropDownListStatus.SelectedValue), Int32.Parse(DropDownListDate.SelectedValue)); foreach (Order order in allOrders) { TableRow tr = new TableRow(); TableCell tc = new TableCell(); tc.Text = order.OrderSerialNumber.ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = order.OrderID; tr.Cells.Add(tc); tc = new TableCell(); tc.Text = order.UserID.ToString(); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = order.ModiefiedDate.ToString(); tr.Cells.Add(tc); tc = new TableCell(); HyperLink hl = new HyperLink(); hl.Text = "操作"; hl.NavigateUrl = "/Admin/OrderInfo.aspx?orderID=" + order.OrderID; tc.Controls.Add(hl); tr.Cells.Add(tc); Table.Rows.Add(tr); } }
private TableCell CreateLinks(SoftwareDto software) { var tc = new TableCell(); var btnDetail = new Button { Text = "Details", CssClass = "btn btn-info", ID = "btnDetail_" + software.Id, PostBackUrl = "SoftwareDetails.aspx?id=" + software.Id }; var btnEdit = new Button { ID = "btnEdit_" + software.Id, Text = "Edit", CssClass = "btn btn-warning", PostBackUrl = "SoftwareEdit.aspx?id=" + software.Id }; var btnDelete = new Button { Text = "Delete", CssClass="btn btn-danger" }; tc.Controls.Add(btnDetail); tc.Controls.Add(new Label() { Text = " " }); tc.Controls.Add(btnEdit); tc.Controls.Add(new Label() { Text = " " }); tc.Controls.Add(btnDelete); return tc; }
/// <summary> /// Overridden to replace the button with a confirmed button /// </summary> public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType) { base.InitializeCell(cell, columnIndex, itemType); if ( itemType != ListItemType.Footer && itemType != ListItemType.Header ) { WebControl theButton = null; if ( this.ButtonType == ButtonColumnType.LinkButton ) { ConfirmedLinkButton theLinkButton = new ConfirmedLinkButton(); theLinkButton.Text = this.Text; theLinkButton.CommandName = this.CommandName; theLinkButton.CausesValidation = false; theLinkButton.Message = this.Message; theLinkButton.ID = theLinkButton.ClientID; theButton = theLinkButton; } else { ConfirmedButton theNormalButton = new ConfirmedButton(); theNormalButton.Text = this.Text; theNormalButton.CommandName = this.CommandName; theNormalButton.CausesValidation = false; theNormalButton.Message = this.Message; theNormalButton.ID = theNormalButton.ClientID; theButton = theNormalButton; } if (this.DataTextField.Length != 0) { theButton.DataBinding += new EventHandler( OnDataBindColumn ); } cell.Controls.Clear(); cell.Controls.Add(theButton); } }
public void InstantiateIn(Control control) { control.Controls.Clear(); Table table = new Table(); table.BorderWidth = Unit.Pixel(0); table.CellSpacing = 1; table.CellPadding = 0; TableRow row = new TableRow(); row.VerticalAlign = VerticalAlign.Top; table.Rows.Add(row); TableCell cell = new TableCell(); cell.HorizontalAlign = HorizontalAlign.Right; cell.VerticalAlign = VerticalAlign.Middle; cell.Controls.Add(First); cell.Controls.Add(Previous); row.Cells.Add(cell); cell = new TableCell(); cell.HorizontalAlign = HorizontalAlign.Center; cell.Controls.Add(Pager); row.Cells.Add(cell); cell = new TableCell(); cell.VerticalAlign = VerticalAlign.Middle; cell.Controls.Add(Next); cell.Controls.Add(Last); row.Cells.Add(cell); control.Controls.Add(table); }
private void showProjects() { List<ProjectInfo> projects = ProjectInfo.getUserProjects(Membership.GetUser(false).UserName, activeProjectsOnly); TableRow row = new TableRow(); Label cell = new Label(); cell.Text = "<div class = \"tblProjects\">"; int i = 0; foreach (ProjectInfo info in projects) { if (i != 2) { cell.Text = "<img src=\"images\\tools_white.png\"/><a href =\"section.aspx?id=" + info.ProjectID + "\"><div class = projName>" + info.Name + "</div></a>" + "<div class = projDesc>" + info.Description + "</div>"; TableCell cell1 = new TableCell(); cell1.Text = cell.Text.ToString(); row.Cells.Add(cell1); i++; } else { cell.Text = "<img src=\"images\\tools_white.png\"/><a href =\"section.aspx?id=" + info.ProjectID + "\"><div class = projName>" + info.Name + "</div></a>" + "<div class = projDesc>" + info.Description + "</div></tr><tr>"; TableCell cell1 = new TableCell(); cell1.Text = cell.Text.ToString(); row.Cells.Add(cell1); i = 0; } } tblProjects.Rows.Add(row); cell.Text += "</div>"; }
public void createTable() { Reservation reservation = (Reservation)Session["reservationBusy"]; List<WorkStation> busy = new List<WorkStation>(reservation.WsBusy); int cont = 1; int z = 0; for (int i = 0; i < 6; i++) { TableRow tr = new TableRow(); myTable.Rows.Add(tr); for (int j = 0; j < 5; j++) { TableCell tc = new TableCell(); tc.ID = "" + cont; ImageButton btn = new ImageButton(); if (z < busy.Count) { if (busy[z].Busy == true) { btn.ImageUrl = "img/StationBusy.png"; btn.Enabled = false; } else { btn.ImageUrl = "Images/indice.png"; } } btn.Click += new ImageClickEventHandler(btn_Click); tc.Controls.Add(btn); tr.Cells.Add(tc); cont++; z++; } } }
public static void BuildStudentProspectTable(Table table, string userId) { GroupService service = new GroupService(); DataTable dtProspects = service.GetProspectiveStudentsData(userId); DataTable dtGroups = service.GetSupervisorOfData(userId); for (int i = 0; i < dtProspects.Rows.Count; i++) { DropDownList ddlGroupList = new DropDownList(); ddlGroupList.DataSource = dtGroups; ddlGroupList.DataTextField = "GroupName"; ddlGroupList.DataValueField = "GroupId"; ddlGroupList.DataBind(); ddlGroupList.Items.Insert(0, "Add a group"); string name = dtProspects.Rows[i].ItemArray[0].ToString(); string id = dtProspects.Rows[i].ItemArray[1].ToString(); LinkButton b = new LinkButton(); b.Text = name; b.CommandArgument = id; b.CommandName = name; TableRow row = new TableRow(); TableCell cellProspects = new TableCell(); TableCell cellGroups = new TableCell(); cellProspects.Controls.Add(b); cellGroups.Controls.Add(ddlGroupList); row.Cells.Add(cellProspects); row.Cells.Add(cellGroups); table.Rows.Add(row); } }
public virtual void AddTH(string text) { this._tag = TableTag.TableHeaderCell; _cellHeader = new TableHeaderCell();//此处根据实际情况进行调整 _cellHeader.Text = text; _row.Cells.AddAt(this._index, _cellHeader); this._index++; }
public virtual void AddTD(string text) { this._tag = TableTag.TableCell; this._cell = new TableCell(); this._cell.Text = text; this._row.Cells.AddAt(this._index, _cell); this._index++; }
protected override void OnDayRender(ASP.TableCell cell, ASP.CalendarDay day) { base.OnDayRender(cell, day); if (this.mouseOverStyle != null && !day.IsSelected) { cell.Attributes.Add("onmouseover", Utils.GetJavaScriptStyleString(this.mouseOverStyle)); cell.Attributes.Add("onmouseout", Utils.GetJavaScriptStyleString(cell.ControlStyle)); } }
/// <summary> /// Gets the design time HTML code. /// </summary> /// <returns>A string containing the HTML to render.</returns> public override string GetDesignTimeHtml() { PagedControl pagerBuilder = (PagedControl)base.Component; StringBuilder stringBuilder = new StringBuilder(); StringWriter stringWriter = new StringWriter(); HtmlTextWriter writer = new HtmlTextWriter(stringWriter); // Initialize the structure. System.Web.UI.WebControls.Table pagerPanel = new System.Web.UI.WebControls.Table(); System.Web.UI.WebControls.TableRow pagerPanelRow = new System.Web.UI.WebControls.TableRow(); System.Web.UI.WebControls.TableCell pagerPanelInfoCell = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TableCell pagerPanelNavigationCell = new System.Web.UI.WebControls.TableCell(); pagerPanelRow.Cells.Add(pagerPanelInfoCell); pagerPanelRow.Cells.Add(pagerPanelNavigationCell); pagerPanel.Rows.Add(pagerPanelRow); // Initialize structure appearance pagerPanel.ApplyStyle(pagerBuilder.PagerStyle); pagerPanel.Width = pagerBuilder.Width; pagerPanel.Height = pagerBuilder.Height; pagerPanel.HorizontalAlign = pagerBuilder.HorizontalAlign; pagerPanel.CellPadding = pagerBuilder.CellPadding; pagerPanel.CellSpacing = pagerBuilder.CellSpacing; pagerPanelRow.CssClass = pagerBuilder.PanelCssClass; //pagerBuilder.InfoPanelStyle.MergeWith(pagerBuilder.PagerStyle); //pagerPanelInfoCell.ApplyStyle(pagerBuilder.InfoPanelStyle); pagerPanelInfoCell.ApplyStyle(pagerBuilder.PagerStyle); pagerPanelInfoCell.HorizontalAlign = pagerBuilder.InfoPanelHorizontalAlign; pagerPanelInfoCell.VerticalAlign = pagerBuilder.InfoPanelVerticalAlign; pagerPanelInfoCell.Visible = !pagerBuilder.InfoPanelDisabled; //pagerBuilder.NavPanelStyle.MergeWith(pagerBuilder.PagerStyle); //pagerPanelNavigationCell.ApplyStyle(pagerBuilder.NavPanelStyle); pagerPanelNavigationCell.ApplyStyle(pagerBuilder.PagerStyle); pagerPanelNavigationCell.HorizontalAlign = pagerBuilder.NavPanelHorizontalAlign; pagerPanelNavigationCell.VerticalAlign = pagerBuilder.NavPanelVerticalAlign; // Initialize the info panel pagerBuilder.BuildInfo(pagerPanelInfoCell, true); // Initialize the navigation panel pagerBuilder.BuildNavigation(pagerPanelNavigationCell); // Add the whole structure to the control collection pagerPanel.RenderControl(writer); return(stringWriter.ToString()); }
// All the .NET API related methods. #region DOTNET API /// <summary> /// Create the child controls. /// </summary> protected override void CreateChildControls() { //PrintStatus(); // Initialize the structure. System.Web.UI.WebControls.Table pagerPanel = new System.Web.UI.WebControls.Table(); System.Web.UI.WebControls.TableRow pagerPanelRow = new System.Web.UI.WebControls.TableRow(); System.Web.UI.WebControls.TableCell pagerPanelInfoCell = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TableCell pagerPanelNavigationCell = new System.Web.UI.WebControls.TableCell(); pagerPanelRow.Cells.Add(pagerPanelInfoCell); pagerPanelRow.Cells.Add(pagerPanelNavigationCell); pagerPanel.Rows.Add(pagerPanelRow); // Initialize structure appearance pagerPanel.ApplyStyle(this.PagerStyle); pagerPanel.Width = this.Width; pagerPanel.Height = this.Height; pagerPanel.HorizontalAlign = this.HorizontalAlign; pagerPanel.CellPadding = CellPadding; pagerPanel.CellSpacing = CellSpacing; pagerPanel.BorderWidth = BorderWidth; pagerPanel.CssClass = CssClass; pagerPanelRow.CssClass = PanelCssClass; //this.InfoPanelStyle.MergeWith(this.PagerStyle); //pagerPanelInfoCell.ApplyStyle(this.InfoPanelStyle); pagerPanelInfoCell.ApplyStyle(this.PagerStyle); pagerPanelInfoCell.HorizontalAlign = InfoPanelHorizontalAlign; pagerPanelInfoCell.VerticalAlign = InfoPanelVerticalAlign; pagerPanelInfoCell.Visible = !this.InfoPanelDisabled; //this.NavPanelStyle.MergeWith(this.PagerStyle); //pagerPanelNavigationCell.ApplyStyle(this.NavPanelStyle); pagerPanelNavigationCell.ApplyStyle(this.PagerStyle); pagerPanelNavigationCell.HorizontalAlign = NavPanelHorizontalAlign; pagerPanelNavigationCell.VerticalAlign = NavPanelVerticalAlign; pagerPanelNavigationCell.Visible = !this.NavPanelDisabled; // Initialize the info panel BuildInfo(pagerPanelInfoCell, false); // Initialize the navigation panel BuildNavigation(pagerPanelNavigationCell); // Add the whole structure to the control collection this.Controls.Add(pagerPanel); //PrintStatus(); }
private void ShowMessage(string Message) { this.ErrTable.Rows.Clear(); System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label(); lbl.CssClass = "tbl1_err"; lbl.Text = Message; System.Web.UI.WebControls.TableRow row = new System.Web.UI.WebControls.TableRow(); System.Web.UI.WebControls.TableCell cell = new System.Web.UI.WebControls.TableCell(); cell.Controls.Add(lbl); row.Cells.Add(cell); this.ErrTable.Rows.Add(row); }
private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); System.Web.UI.WebControls.Table tbl = new System.Web.UI.WebControls.Table(); tbl.Rows.Add(new System.Web.UI.WebControls.TableRow()); tbl.Rows.Add(new System.Web.UI.WebControls.TableRow()); //add new cell tbl.Rows[0].Cells.Add(new System.Web.UI.WebControls.TableCell()); tbl.Rows[0].Cells.Add(new System.Web.UI.WebControls.TableCell()); tbl.Rows[0].Cells.Add(new System.Web.UI.WebControls.TableCell()); tbl.Rows[0].Cells.Add(new System.Web.UI.WebControls.TableCell()); tbl.Rows[0].Cells[0].Text = "111"; tbl.Rows[0].Cells[1].Text = "222"; tbl.Rows[0].Cells[2].Text = "333"; tbl.Rows[0].Cells[3].Text = "444"; System.Collections.IEnumerator Ienm = tbl.Rows[0].Cells.GetEnumerator(); System.Web.UI.WebControls.TableCell tblCell = new System.Web.UI.WebControls.TableCell(); try { base.GHTSubTestBegin("IEnumerator - get"); base.GHTSubTestAddResult("IEnumerator=null? " + ((Ienm == null) ? "True" : "False")); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); try { base.GHTSubTestBegin("Using IEnumerator"); while (Ienm.MoveNext()) { base.GHTSubTestAddResult(" CellText = " + ((System.Web.UI.WebControls.TableCell)(Ienm.Current)).Text); } } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); base.GHTTestEnd(); }
//生成叶子节点单元格 private System.Web.UI.WebControls.TableCell CreateLeafCell(ref System.Web.UI.WebControls.TableCell objCell, string strID, string strName, string strDesc, string strBasic, string strBindOperCode, string strNodeCode, string strOperCode, bool blnChk, bool blnIsEna, bool isHide) { System.Web.UI.HtmlControls.HtmlGenericControl objChk = new HtmlGenericControl(); System.Web.UI.HtmlControls.HtmlGenericControl objControl = new HtmlGenericControl(); objCell.Style.Add("width", "100%"); objCell.Style.Add("valign", "top"); objCell.HorizontalAlign = HorizontalAlign.Left; objChk.TagName = "input"; objChk.Attributes.Add("type", "checkbox"); //if (blnChk) //{ // objChk.Attributes.Add("checked", blnChk.ToString().ToLower()); //} if (blnIsEna) { objChk.Attributes.Add("disabled", "false"); } if (isHide) { objChk.Attributes.Add("style", "display:none"); } else if (blnChk) { objChk.Attributes.Add("checked", blnChk.ToString().ToLower()); } objChk.Attributes.Add("onclick", "chkOnClickEx('" + strID + "',this)"); objChk.Attributes.Add("basic", strBasic); objChk.ID = strID; objChk.Attributes.Add("name", strName); objChk.Attributes.Add("BindOperCode", strBindOperCode); objChk.Attributes.Add("NodeCode", strNodeCode); objChk.Attributes.Add("OperCode", strOperCode); objCell.Controls.Add(objChk); objControl.TagName = "label"; if (isHide) { objControl.Attributes.Add("style", "display:none"); } objControl.Attributes.Add("for", strID); objControl.InnerText = strDesc; objCell.Controls.Add(objControl); // objTblRow.Controls.Add(objCell); return(objCell); }
private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); System.Web.UI.WebControls.Table tbl = new System.Web.UI.WebControls.Table(); tbl.Rows.Add(new System.Web.UI.WebControls.TableRow()); tbl.Rows.Add(new System.Web.UI.WebControls.TableRow()); //add new cell tbl.Rows[0].Cells.Add(new System.Web.UI.WebControls.TableCell()); tbl.Rows[0].Cells.Add(new System.Web.UI.WebControls.TableCell()); tbl.Rows[1].Cells.Add(new System.Web.UI.WebControls.TableCell()); tbl.Rows[1].Cells.Add(new System.Web.UI.WebControls.TableCell()); tbl.Rows[0].Cells[0].Text = "111"; tbl.Rows[0].Cells[1].Text = "222"; tbl.Rows[1].Cells[0].Text = "333"; tbl.Rows[1].Cells[1].Text = "444"; System.Web.UI.WebControls.TableCell tblCell = new System.Web.UI.WebControls.TableCell(); try { base.GHTSubTestBegin("GetCellIndex"); base.GHTActiveSubTest.Controls.Add(tbl); base.GHTSubTestAddResult("GetCellIndex=" + tbl.Rows[0].Cells.GetCellIndex(tblCell)); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); tbl.Rows[0].Cells.Add(tblCell); try { base.GHTSubTestBegin("GetCellIndex"); base.GHTSubTestAddResult("GetCellIndex=" + tbl.Rows[0].Cells.GetCellIndex(tblCell)); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); base.GHTTestEnd(); }
protected TableCell createAdminUser(int iRowNo) { tblAthenCell = new TableCell(); rbAthn = new RadioButton(); rbAthn.ID = "rbSuperYes" + iRowNo; rbAthn.Text = "Yes"; rbAthn.GroupName = "super" + iRowNo; tblAthenCell.Controls.Add(rbAthn); rbAthn = new RadioButton(); rbAthn.ID = "rbSuperNo" + iRowNo; rbAthn.Text = "No"; rbAthn.Checked = true; rbAthn.GroupName = "super" + iRowNo; tblAthenCell.Controls.Add(rbAthn); return(tblAthenCell); }
public System.Web.UI.WebControls.Table CreateTable(System.Web.UI.WebControls.TableCell objCell, string strID) { System.Web.UI.WebControls.Table objTbl = new Table(); objTbl.Style.Add("width", "100%"); if (strID.Length == 6) { objTbl.Style.Add("display", "none"); } objTbl.CellPadding = 0; objTbl.CellSpacing = 0; if (strID.Length > 0) { objTbl.Attributes.Add("name", strID); } objCell.Controls.Add(objTbl); return(objTbl); }
public override void InitializeCell(System.Web.UI.WebControls.TableCell cell, int columnIndex, ListItemType itemType) { base.InitializeCell(cell, columnIndex, itemType); if (this.ColumnSpan != 1) { cell.ColumnSpan = this.ColumnSpan; } switch (itemType) { case ListItemType.Header: if (HeaderTemplate == null) { cell.Visible = false; } else { InitializeBreakpointCell((IBreakPointControl)cell); } if (!string.IsNullOrEmpty(HeaderId)) { cell.ID = HeaderId; } break; case ListItemType.Item: case ListItemType.AlternatingItem: if (ItemTemplate == null) { cell.Visible = false; } else { InitializeBreakpointCell((IBreakPointControl)cell); } if (!string.IsNullOrEmpty(ItemId)) { cell.ID = ItemId; } break; default: break; } }
private void ShowException(Exception exc) { if (Common.AppConfig.IsDebugMode) { Common.LogWriter.Instance.WriteEventLogEntry(exc); } System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label(); lbl.CssClass = "tbl1_err"; lbl.Text = exc.Message; System.Web.UI.WebControls.TableRow row = new System.Web.UI.WebControls.TableRow(); System.Web.UI.WebControls.TableCell cell = new System.Web.UI.WebControls.TableCell(); cell.Controls.Add(lbl); row.Cells.Add(cell); this.ErrTable.Rows.Add(row); }
protected override void OnRowCreated(ASP.GridViewRowEventArgs e) { base.OnRowCreated(e); if (e.Row != null) { switch (e.Row.RowType) { case ASP.DataControlRowType.Header: this.SetSortHeaderAttributes(e); break; case ASP.DataControlRowType.DataRow: if (this.sortColumnIndex > -1) { ASP.TableCell td = e.Row.Cells[this.sortColumnIndex]; td.ApplyStyle(this.SortedColumnRowStyle); } break; } } }
protected void createAthenTable(int iCount) { for (int iloop = 1; iloop <= iCount; iloop++) { tblAthenRow = new TableRow(); tblAthenCell = new TableCell(); tblAthenCell.Controls.Add(createDropDown(iloop)); tblAthenRow.Controls.Add(tblAthenCell); tblAthenCell = new TableCell(); tblAthenCell.Controls.Add(createMouleTable(iloop)); tblAthenRow.Controls.Add(tblAthenCell); tblAthen.Controls.Add(tblAthenRow); } tblAthen.Controls.Add(tblAthenRow); }
/// <summary> /// 将此控件呈现给指定的输出参数。 /// </summary> /// <param name="writer"> 要写出到的 HTML 编写器 </param> private void Render_TopToBottom(HtmlTextWriter writer) { this.RenderBeginTag(writer); if (this.Htmls.Count > 0) { System.Web.UI.WebControls.Table tableArray = new System.Web.UI.WebControls.Table(); tableArray.Width = System.Web.UI.WebControls.Unit.Parse("100%"); tableArray.BorderWidth = System.Web.UI.WebControls.Unit.Parse("0px"); tableArray.CellPadding = 0; tableArray.CellSpacing = 0; for (int i = 0; i < this.Htmls.Count; i++) { System.Web.UI.WebControls.TableRow trowArray = new System.Web.UI.WebControls.TableRow(); tableArray.Rows.Add(trowArray); System.Web.UI.WebControls.TableCell tc = new System.Web.UI.WebControls.TableCell(); tc.Text = this.Htmls[i]; trowArray.Cells.Add(tc); if (this.Interval != System.Web.UI.WebControls.Unit.Empty)//插入 HTML 代码块 之间的间隔距离。 { System.Web.UI.WebControls.TableRow sptrowArray = new System.Web.UI.WebControls.TableRow(); tableArray.Rows.Add(sptrowArray); System.Web.UI.WebControls.TableCell sptc = new System.Web.UI.WebControls.TableCell(); sptc.Text = "<div style=\"HEIGHT:" + this.Interval.ToString() + "\" />"; sptrowArray.Cells.Add(sptc); } } System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw); tableArray.RenderControl(htw); writer.Write(sw.ToString()); } writer.Write(@"<script type=""text/javascript""> HtmlRotator('" + this.ClientID + @"', 3, " + this.PlaySpeed.ToString() + @", " + this.PauseTime.ToString() + ", " + this.StopOnMouseOver.ToString().ToLower() + @"); </script> "); this.RenderEndTag(writer); }
public static void AddCell(string cellContents) { System.Web.UI.WebControls.TableCell cell = new System.Web.UI.WebControls.TableCell(); cell.Text = cellContents; }
protected override void SetupFilterControls(System.Web.UI.WebControls.TableCell cell) { }
protected override void SetCurrentFilterValueToControl(System.Web.UI.WebControls.TableCell cell) { }
protected Table createMouleTable(int iRow) { clsAuthorizationDetails objAutho = new clsAuthorizationDetails(); List <EntModuleDetails> lst = objAutho.getModuleList(); Session[clsConstant.SESS_MODULE] = lst; tblModule = new Table(); tblModule.CellPadding = 2; tblModule.CellSpacing = 2; tblModHrRow = new TableHeaderRow(); tblModRow = new TableRow(); for (int iloop = 0; iloop < lst.Count; iloop++) { tblModHrCell = new TableHeaderCell(); lblHeading = new Label(); lblHeading.Text = Server.HtmlEncode(lst[iloop].ModuleName); lblHeading.ID = "lblHeading" + iRow + "_" + iloop; lblHeading.Font.Bold = true; tblModHrCell.Controls.Add(lblHeading); tblModHrRow.Controls.Add(tblModHrCell); tblModCell = new TableCell(); chkbox = new CheckBox(); chkbox.Text = "View"; chkbox.ID = "chkView" + iRow + "_" + lst[iloop].ModuleID; tblModCell.Controls.Add(chkbox); if (lst[iloop].ModuleID == clsConstant.NOMIATION_ID) { chkbox = new CheckBox(); chkbox.Text = "Upload"; chkbox.ID = "chkUpload" + iRow + "_" + lst[iloop].ModuleID; tblModCell.Controls.Add(chkbox); chkbox = new CheckBox(); chkbox.Text = "Short List"; chkbox.ID = "chkShortList" + iRow + "_" + lst[iloop].ModuleID; tblModCell.Controls.Add(chkbox); chkbox = new CheckBox(); chkbox.Text = "Approve"; chkbox.ID = "chkApprove" + iRow + "_" + lst[iloop].ModuleID; tblModCell.Controls.Add(chkbox); } else { chkbox = new CheckBox(); chkbox.Text = "Edit"; chkbox.ID = "chkEdit" + iRow + "_" + lst[iloop].ModuleID; tblModCell.Controls.Add(chkbox); } tblModRow.Controls.Add(tblModCell); } tblModule.Controls.Add(tblModHrRow); tblModule.Controls.Add(tblModRow); return(tblModule); }
private void CreateCoolPager(ASP.TableRow row, int columnSpan, ASP.PagedDataSource pagedDataSource) { int pageIndex = pagedDataSource.CurrentPageIndex; int pageCount = pagedDataSource.PageCount; int pageSize = pagedDataSource.PageSize; int total = pagedDataSource.DataSourceCount; ASP.TableCell td = new ASP.TableCell(); DropDownList ddlPageSelector = new DropDownList(); Button btnFirst = new Button(); Button btnLast = new Button(); Button btnNext = new Button(); Button btnPrev = new Button(); Label lblTotal = new Label(); td.ColumnSpan = columnSpan; row.Cells.Add(td); td.Controls.Add(new LiteralControl(" Page : ")); td.Controls.Add(ddlPageSelector); td.Controls.Add(btnFirst); td.Controls.Add(btnPrev); td.Controls.Add(btnNext); td.Controls.Add(btnLast); td.Controls.Add(lblTotal); btnNext.Text = ">"; btnNext.CommandArgument = "Next"; btnNext.CommandName = "Page"; btnLast.Text = ">>"; btnLast.CommandArgument = "Last"; btnLast.CommandName = "Page"; btnFirst.Text = "<<"; btnFirst.CommandArgument = "First"; btnFirst.CommandName = "Page"; btnPrev.Text = "<"; btnPrev.CommandArgument = "Prev"; btnPrev.CommandName = "Page"; lblTotal.Text = this.TotalRecordString + " " + total.ToString(); btnFirst.Enabled = btnPrev.Enabled = (pageIndex != 0); btnNext.Enabled = btnLast.Enabled = (pageIndex < (pageCount - 1)); ddlPageSelector.Items.Clear(); if (this.AddCallBacks) { ddlPageSelector.AutoCallBack = true; } else { ddlPageSelector.AutoPostBack = true; } for (int i = 1; i <= pageCount; i++) { ddlPageSelector.Items.Add(i.ToString()); } ddlPageSelector.SelectedIndex = pageIndex; ddlPageSelector.SelectedIndexChanged += delegate { this.PageIndex = ddlPageSelector.SelectedIndex; this.DataBind(); }; }
protected void createViewAthenTable() { clsAuthorizationDetails objAutho = new clsAuthorizationDetails(); List <EntModuleDetails> lst = objAutho.getModuleList(); Session[clsConstant.SESS_MODULE] = lst; tblHrModuleView.ColumnSpan = lst.Count * 2; tblAthenRow = new TableRow(); tblAthenCell = new TableCell(); tblAthenRow.Controls.Add(tblAthenCell); for (int iloop = 0; iloop < lst.Count; iloop++) { tblModHrCell = new TableHeaderCell(); if (lst[iloop].ModuleID == clsConstant.NOMIATION_ID) { tblModHrCell.ColumnSpan = 4; } else { tblModHrCell.ColumnSpan = 2; } lblHeading = new Label(); lblHeading.Text = Server.HtmlEncode(lst[iloop].ModuleName); lblHeading.ID = "lblModule" + iloop; tblModHrCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModHrCell); } tblAthenView.Controls.Add(tblAthenRow); tblAthenRow = new TableRow(); tblAthenCell = new TableCell(); tblAthenRow.Controls.Add(tblAthenCell); for (int iloop = 0; iloop < lst.Count; iloop++) { tblModHrCell = new TableHeaderCell(); tblModHrCell.HorizontalAlign = HorizontalAlign.Center; lblHeading = new Label(); lblHeading.Text = Server.HtmlEncode("VIEW"); lblHeading.ID = "lblView" + iloop; tblModHrCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModHrCell); tblModHrCell.HorizontalAlign = HorizontalAlign.Center; if (lst[iloop].ModuleID == clsConstant.NOMIATION_ID) { tblModHrCell = new TableHeaderCell(); lblHeading = new Label(); lblHeading.Text = Server.HtmlEncode("UPLOAD"); lblHeading.ID = "lblUpload" + iloop; tblModHrCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModHrCell); tblModHrCell = new TableHeaderCell(); lblHeading = new Label(); lblHeading.Text = Server.HtmlEncode("SHORT-LIST"); lblHeading.ID = "lblShortList" + iloop; tblModHrCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModHrCell); tblModHrCell = new TableHeaderCell(); lblHeading = new Label(); lblHeading.Text = Server.HtmlEncode("APPROVE"); lblHeading.ID = "lblApprove" + iloop; tblModHrCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModHrCell); } else { tblModHrCell = new TableHeaderCell(); lblHeading = new Label(); lblHeading.Text = Server.HtmlEncode("EDIT"); lblHeading.ID = "lblEdit" + iloop; tblModHrCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModHrCell); } } tblAthenView.Controls.Add(tblAthenRow); objAutho = new clsAuthorizationDetails(); List <entAthen> lstRole = objAutho.getRoleListFromAthen(); List <entRoleCount> listRoleCount = objAutho.getRoleCountList(); int iCount = 0; for (int iloop = 0; iloop < listRoleCount.Count; iloop++) { tblAthenRow = new TableRow(); tblModCell = new TableCell(); lblHeading = new Label(); tblModCell.HorizontalAlign = HorizontalAlign.Center; lblHeading.Text = Server.HtmlEncode(listRoleCount[iloop].RoleName); lblHeading.ID = "lblRole" + iloop; tblModCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModCell); for (int jloop = 0; jloop < lst.Count; jloop++) { if (lst[jloop].ModuleID == clsConstant.NOMIATION_ID) { List <EntNomAuthorizationDetails> lstNom; lstNom = objAutho.GetNomAthenDetails(listRoleCount[iloop].RoleID); bool isView = false; bool isUpload = false; bool isShortList = false; bool isApprove = false; if (lstNom.Count > 0) { isView = lstNom[0].isView; isUpload = lstNom[0].isUpload; isShortList = lstNom[0].isShortList; isApprove = lstNom[0].isApprove; } tblModCell = new TableCell(); lblHeading = new Label(); tblModCell.HorizontalAlign = HorizontalAlign.Center; lblHeading.Text = isView.ToString(); lblHeading.ID = "lblView_" + iloop + "_" + iCount; tblModCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModCell); tblModCell = new TableCell(); lblHeading = new Label(); tblModCell.HorizontalAlign = HorizontalAlign.Center; lblHeading.Text = isUpload.ToString(); lblHeading.ID = "lblUpload_" + iloop + "_" + iCount; tblModCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModCell); tblModCell = new TableCell(); lblHeading = new Label(); tblModCell.HorizontalAlign = HorizontalAlign.Center; lblHeading.Text = isShortList.ToString(); lblHeading.ID = "lblShortList_" + iloop + "_" + iCount; tblModCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModCell); tblModCell = new TableCell(); lblHeading = new Label(); tblModCell.HorizontalAlign = HorizontalAlign.Center; lblHeading.Text = isApprove.ToString(); lblHeading.ID = "lblApprove_" + iloop + "_" + iCount; tblModCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModCell); } else if (lstRole.Count > iCount) { if (lst[jloop].ModuleID == lstRole[iCount].ModuleID) { tblModCell = new TableCell(); lblHeading = new Label(); tblModCell.HorizontalAlign = HorizontalAlign.Center; lblHeading.Text = lstRole[iCount].isView.ToString(); lblHeading.ID = "lblView_" + iloop + "_" + iCount; tblModCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModCell); tblModCell = new TableCell(); lblHeading = new Label(); tblModCell.HorizontalAlign = HorizontalAlign.Center; lblHeading.Text = lstRole[iCount].isEdit.ToString(); lblHeading.ID = "lblEdit_" + iloop + "_" + iCount; tblModCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModCell); } else { tblModCell = new TableCell(); lblHeading = new Label(); tblModCell.HorizontalAlign = HorizontalAlign.Center; lblHeading.Text = "False"; lblHeading.ID = "lblView_" + iloop + "_" + iCount; tblModCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModCell); tblModCell = new TableCell(); lblHeading = new Label(); tblModCell.HorizontalAlign = HorizontalAlign.Center; lblHeading.Text = "False"; lblHeading.ID = "lblEdit_" + iloop + "_" + iCount; tblModCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModCell); } } else { tblModCell = new TableCell(); lblHeading = new Label(); tblModCell.HorizontalAlign = HorizontalAlign.Center; lblHeading.Text = "False"; lblHeading.ID = "lblView_" + iloop + "_" + iCount; tblModCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModCell); tblModCell = new TableCell(); lblHeading = new Label(); tblModCell.HorizontalAlign = HorizontalAlign.Center; lblHeading.Text = "False"; lblHeading.ID = "lblEdit_" + iloop + "_" + iCount; tblModCell.Controls.Add(lblHeading); tblAthenRow.Controls.Add(tblModCell); } iCount = iCount + 1; } tblAthenView.Controls.Add(tblAthenRow); } tblAthenView.Controls.Add(tblAthenRow); tblHrModuleView.ColumnSpan = (lst.Count * 2) + 2; }