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); } } }
public virtual void NewRow(TableRowSection section) { this._tag = TableTag.TableRow; _row = new TableRow(); _row.TableSection = section; this._index = 0; }
public virtual void NewRow() { this._tag = TableTag.TableRow; _row = new TableRow(); _row.TableSection = TableRowSection.TableBody; this._index = 0; }
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); } } } }
public System.Web.UI.WebControls.TableCell CreateCell(ref System.Web.UI.WebControls.TableRow objTblRow) { System.Web.UI.WebControls.TableCell objCell = new TableCell(); objCell.Style.Add("width", "100%"); objTblRow.Cells.Add(objCell); return(objCell); }
public Table ManualColorLegend(List <Color> colors) { Table legend = new Table(); for (int i = 0; i < this._colorLevels.Count; i++) { string s = this._colorLevels[i]; System.Web.UI.WebControls.TableRow tr = new System.Web.UI.WebControls.TableRow(); TableCell td1 = new TableCell(); TableCell td2 = new TableCell(); td1.BackColor = colors[i]; td1.Width = 15; td1.Style.Add("padding", "4px"); td2.Style.Add("padding", "4px"); td2.Text = s; td1.BorderColor = Color.White; td2.BorderColor = Color.White; td1.BorderWidth = 2; td2.BorderWidth = 2; tr.Cells.Add(td1); tr.Cells.Add(td2); legend.Rows.Add(tr); } return(legend); }
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 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(); System.Web.UI.WebControls.Table tbl = new System.Web.UI.WebControls.Table(); try { base.GHTSubTestBegin("Add rows"); base.GHTActiveSubTest.Controls.Add(tbl); base.GHTActiveSubTest.Controls.Add(tbl1); //add new row tbl1.Rows.Add(new System.Web.UI.WebControls.TableRow()); tbl.Rows.Add(new System.Web.UI.WebControls.TableRow()); System.Web.UI.WebControls.TableRow tblRow = new System.Web.UI.WebControls.TableRow(); tbl.Rows.Add(tblRow); //add row from one table to another tbl.Rows.Add(tbl1.Rows[0]); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); base.GHTTestEnd(); }
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); }
/// <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 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); }
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 myTable = new System.Web.UI.WebControls.Table(); int numRows = 4; // Create 3 rows, each containing 2 cells. System.Web.UI.WebControls.TableRow [] arrayOfTableRows = new System.Web.UI.WebControls.TableRow[numRows]; for (int j = 0; j < numRows; j++) { System.Web.UI.WebControls.TableRow myTableRow = new System.Web.UI.WebControls.TableRow(); myTableRow.Cells.Add(new System.Web.UI.WebControls.TableCell()); myTableRow.Cells[0].Text = "Row " + j.ToString(); arrayOfTableRows[j] = myTableRow; } try { base.GHTSubTestBegin("AddRange Rows"); base.GHTActiveSubTest.Controls.Add(myTable); myTable.Rows.AddRange(arrayOfTableRows); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); base.GHTTestEnd(); }
protected void fillButtons() { // Create the row // We are going to use one row only TableRow row = new TableRow(); // Create the cells TableHeaderCell addRecordsCell = new TableHeaderCell(); TableHeaderCell addTimeOffCell = new TableHeaderCell(); TableHeaderCell addIncomeCell = new TableHeaderCell(); TableHeaderCell addDocumentCell = new TableHeaderCell(); // Add the links to cells Text addRecordsCell.Text = @"<a class='btn btn-warning btn-employee' href='EmployeeAddRecord.aspx?id="+employee.Id+"'><i class='icon-pencil icon-white'></i> Add a Record</a>"; addTimeOffCell.Text = @"<a class='btn btn-warning btn-employee' href='EmployeeAddTimeOff.aspx?id=" + employee.Id + "'><i class='icon-calendar icon-white'></i> Add a Time Off</a>"; addIncomeCell.Text = @"<a class='btn btn-warning btn-employee' href='EmployeeAddIncome.aspx?id=" + employee.Id + "'><i class='icon-plus icon-white'></i> Add an Income</a>"; addDocumentCell.Text = @"<a class='btn btn-warning btn-employee' href='EmployeeAddDocument.aspx?id=" + employee.Id + "'><i class='icon-folder-open icon-white'></i> Add a Document</a>"; // Add the cells to the row row.Cells.Add(addRecordsCell); row.Cells.Add(addTimeOffCell); row.Cells.Add(addIncomeCell); row.Cells.Add(addDocumentCell); // Add the row to the table ButtonsTable.Rows.Add(row); // Add the bootstrap table class to the table ButtonsTable.CssClass = "table centerTD no-border-table buttons-table"; }
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); }
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 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> /// Build a row with the given control and style /// </summary> /// <param name="child"></param> /// <param name="rowStyle"></param> /// <param name="labelText"></param> /// <returns></returns> protected TableRow BuildRow(Control child, string labelText, Style rowStyle) { TableRow row = new TableRow(); TableCell cell = new TableCell(); if (labelText != null) { Label label = new Label(); label.ControlStyle.Font.Bold = true; label.Text = labelText; cell.Controls.Add(label); cell.Wrap = false; if (child == null) cell.ColumnSpan = 2; cell.VerticalAlign = VerticalAlign.Top; row.Cells.Add(cell); cell = new TableCell(); } else { cell.ColumnSpan = 2; } if (child != null) { cell.Controls.Add(child); } row.Cells.Add(cell); row.ControlStyle.CopyFrom(rowStyle); //CSS .addinsLayout return row; }
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 cargar_noti_oferta() { Oferta[] ofertas = new Oferta().cargar_notificacion(Convert.ToString(Session["r_muro"])); if(ofertas !=null){ for (int i = 0; i < ofertas.Length;i++ ) { TableRow fila_nombre_foro = new TableRow(); TableCell celda1 = new TableCell(); HyperLink link = new HyperLink(); link.Text = ofertas[i].Usuario; link.NavigateUrl = Global.ruta + "/perfil.aspx?cod=" + ofertas[i].Cod_usuario; celda1.Controls.AddAt(0, link); fila_nombre_foro.Cells.Add(celda1); celda1.Attributes.Add("style", "BORDER-TOP:solid 2px blue"); TableRow espacio = new TableRow(); TableCell celda7 = new TableCell(); celda7.Text = "<br />"; espacio.Cells.Add(celda7); TableRow ofertat = new TableRow(); TableRow oficio_oferta = new TableRow(); TableRow fecha_oferta = new TableRow(); TableRow fecha_limite = new TableRow(); TableRow ir_oferta = new TableRow(); TableCell celda2 = new TableCell(); celda2.Text = "Oferta : " + ofertas[i].Tipo; TableCell celda3 = new TableCell(); celda3.Text = "Oficio : " + ofertas[i].Oficio; TableCell celda4 = new TableCell(); celda4.Text = "Oferta Limte hasta el : " + Convert.ToDateTime(ofertas[i].Fecha_limite).ToString("dd-MM-yyyy"); TableCell celda6 = new TableCell(); celda6.Text = "Oferta creada el : " + Convert.ToDateTime(ofertas[i].Fecha).ToString("dd-MM-yyyy"); TableCell celda5 = new TableCell(); HyperLink link_ir = new HyperLink(); link_ir.Text = "Ir a la oferta"; celda5.Controls.AddAt(0, link_ir); link_ir.NavigateUrl = Global.ruta + "/mostrar_oferta.aspx?id=" + ofertas[i].Id; ofertat.Cells.Add(celda2); oficio_oferta.Cells.Add(celda3); fecha_oferta.Cells.Add(celda4); fecha_limite.Cells.Add(celda6); ir_oferta.Cells.Add(celda5); Table1.Rows.Add(espacio); Table1.Rows.Add(fila_nombre_foro); Table1.Rows.Add(ofertat); Table1.Rows.Add(oficio_oferta); Table1.Rows.Add(fecha_limite); Table1.Rows.Add(fecha_oferta); Table1.Rows.Add(ir_oferta); } } }
private void Page_Load(object sender, System.EventArgs e) { Table tb = new Table(); tb.Width = new Unit( 100, UnitType.Percentage ); TableRow row; TableCell cell; HyperLink lnk; if( Context.User.Identity.IsAuthenticated ) { //create a new blank table row row = new TableRow(); //set up the news link lnk = new HyperLink(); lnk.Text = "News"; lnk.NavigateUrl = "News.aspx"; //create the cell and add the link cell = new TableCell(); cell.Controls.Add(lnk); //add the new cell to the row row.Cells.Add(cell); } else { //code for unauthenticated users here } //finally, add the table to the placeholder phNav.Controls.Add(tb); }
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); }
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); }
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); }
void AddNewRow(Entities.ProductionEntity production, Table table) { var row = new TableRow(); row.ID = "rId_" + production.ProductionCode; row.Cells.Add(new TableCell { Text = production.ProductionCode.ToString() }); row.Cells.Add(new TableCell { Text = production.NameProduction.ToString() }); row.Cells.Add(new TableCell { Text = production.DesignationProduction.ToString() }); // // Раскоментить или удалить, уточнить // //if (production.CountProduction==null) // row.Cells.Add(new TableCell { Text = "0" }); //else // row.Cells.Add(new TableCell { Text = production.CountProduction.ToString() }); //if (production.UnitName == null) // row.Cells.Add(new TableCell { Text = "-" }); //else // row.Cells.Add(new TableCell { Text = production.UnitName.ToString() }); row.Cells.Add(new TableCell { Text = production.TypeName.ToString() }); row.Cells.Add(new TableCell { Text = production.SortName.ToString() }); row.Cells.Add(new TableCell { Text = production.SignName.ToString() }); row.Cells.Add(new TableCell { Text = "<a href=\"/DeleteView/DeleteProduction.aspx?IdProduction=" + production.ProductionCode.ToString() + "\">удалить</a>" }); row.Cells.Add(new TableCell { Text = "<a href=\"/EditingForms/ProductionEdit.aspx?IdProduction=" + production.ProductionCode.ToString() + "\">изменить</a>" }); row.CssClass = "activeRow"; table.Rows.Add(row); }
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); }
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(); }
/// <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; } } }
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++; } } }
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); } }
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 AddToTableRow(List<TableCell> itemValues, TableRow tableRow) { for (int x = 0; x < itemValues.Count; x++) { tableRow.Cells.AddAt(x, itemValues[x]); } }
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>"; }
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 async void GetSoftwares() { using (var client = new SoftwaresClient(GlobalProperties.BaseUrl)) { var softwares = await client.GetSoftwares(); foreach (var item in softwares) { var tr = new TableRow(); tr.Cells.Add(new TableCell() { Text = item.Id.ToString() }); tr.Cells.Add(new TableCell() { Text = item.ManufacturerName }); tr.Cells.Add(new TableCell() { Text = item.Name }); tr.Cells.Add(new TableCell() { Text = item.GenreName }); tr.Cells.Add(CreateLinks(item)); tblSoftwares.Rows.Add(tr); } } }
/// <summary> /// BuildMenu builds the top-level menu. It is called from the OnDataBinding method as well /// as from <see cref="CreateChildControls"/>. It has code to check if the top-level menu should be /// laid out horizontally or vertically. /// </summary> protected virtual void BuildMenu() { // iterate through the Items Table menu = new Table(); menu.Attributes.Add("id", this.ClientID); menu.Width = new Unit("100%"); //menu.Height = new Unit("100%"); menu.CellPadding = 0; menu.CellSpacing = 0; // Iterate through the top-level menu's menuitems, and add a <td> tag for each menuItem for (int ix = 0; ix < this.items.Count; ix++) { MainMenuItem mainMenu = this.items[ix]; TableRow tr = new TableRow(); BuildMainItems(tr, mainMenu, ix); menu.Controls.Add(tr); if (mainMenu.SubItems.Count > 0) { TableRow tr2 = new TableRow(); BuildSubItems(tr2, mainMenu,ix); menu.Controls.Add(tr2); } } Controls.Add(menu); }
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); } }
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; }
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; }
public static void addTableRowCell(System.Web.UI.WebControls.TableRow obj, string addStrings) { TableCell tc = new TableCell(); tc.HorizontalAlign = HorizontalAlign.Center; tc.Text = addStrings; obj.Cells.Add(tc); }
public void addTableRowCell(System.Web.UI.WebControls.TableRow obj, string butStrings, int addrow) { TableCell tc = new TableCell(); tc.HorizontalAlign = HorizontalAlign.Center; tc.Text = "<input align='center' runat='server' type='button' id='butAction' style='font-family:arial; font-size:9px' value='" + butStrings + "' onchange='butAction(" + addrow + ")' />"; obj.Cells.Add(tc); }
/// <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 rows/cells 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.TableRow [] arrRows = new System.Web.UI.WebControls.TableRow[4]; try { base.GHTSubTestBegin("Copy to"); base.GHTActiveSubTest.Controls.Add(tbl); tbl.Rows.CopyTo(arrRows, 1); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); System.Web.UI.WebControls.Table tbl1 = new System.Web.UI.WebControls.Table(); try { base.GHTSubTestBegin("Copy to - check array"); base.GHTActiveSubTest.Controls.Add(tbl1); tbl1.Rows.Add((System.Web.UI.WebControls.TableRow)arrRows[1]); tbl1.Rows.Add((System.Web.UI.WebControls.TableRow)arrRows[2]); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); base.GHTTestEnd(); }
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); }
//生成树单元格 public System.Web.UI.WebControls.TableCell CreateTreeCell(ref System.Web.UI.WebControls.TableRow objTblRow, bool blnExpand, string strText, string strDetailID) { System.Web.UI.WebControls.TableCell objCell = new TableCell(); objCell.Style.Add("width", "1px"); objCell.Attributes.Add("valign", "top"); objCell.Style.Add("background-color", "gainsboro");// System.Web.UI.WebControls.Image objImg = new Image(); objImg.ID = "imgcol" + strDetailID; if (blnExpand) { if (strDetailID.Length == 3) { objImg.ImageUrl = "../images/dtree/nolines_plus.gif"; } else { objImg.ImageUrl = "../images/dtree/nolines_minus.gif"; } } else { objImg.ImageUrl = "../images/dtree/nolines_plus.gif"; } objImg.Attributes.Add("onclick", "showDetail('tbl" + strDetailID + "',this)"); objCell.Controls.Add(objImg); objTblRow.Cells.Add(objCell); objCell = new TableCell(); objCell.Style.Add("width", "100%"); objCell.HorizontalAlign = HorizontalAlign.Left; System.Web.UI.HtmlControls.HtmlGenericControl objChk = new HtmlGenericControl(); objChk.TagName = "input"; objChk.Attributes.Add("type", "checkbox"); objChk.Attributes.Add("onclick", "chkOnClick('chk" + strDetailID + "',this)"); objChk.ID = "chk" + strDetailID; objCell.Controls.Add(objChk); System.Web.UI.HtmlControls.HtmlGenericControl objControl = new HtmlGenericControl(); objControl.TagName = "label"; objControl.Attributes.Add("for", objImg.ID); objControl.InnerHtml = strText; objCell.Controls.Add(objControl); objTblRow.Controls.Add(objCell); return(objCell); }
/// <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); }
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); }
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()); System.Web.UI.WebControls.TableRow tblRow = new System.Web.UI.WebControls.TableRow(); try { base.GHTSubTestBegin("GetRowIndex"); base.GHTActiveSubTest.Controls.Add(tbl); base.GHTSubTestAddResult("GetRowIndex=" + tbl.Rows.GetRowIndex(tblRow)); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); tbl.Rows.Add(tblRow); try { base.GHTSubTestBegin("GetRowIndex"); base.GHTSubTestAddResult("GetRowIndex=" + tbl.Rows.GetRowIndex(tblRow)); } catch (Exception ex) { base.GHTSubTestUnexpectedExceptionCaught(ex); } base.GHTSubTestEnd(); base.GHTTestEnd(); }
private void estudio(string rut) { tituloEstudio.Visible = true; System.Data.SqlClient.SqlConnection adoConn = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["BaseSqlServer"].ConnectionString); adoConn.Open(); System.Web.UI.WebControls.TableRow row = new System.Web.UI.WebControls.TableRow(); System.Web.UI.WebControls.TableCell cell1 = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TableCell cell2 = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TableCell cell3 = new System.Web.UI.WebControls.TableCell(); cell2.Font.Bold = true; string sql = "select anotit, anoegre, rut, nombre_c from MT_ALUMNO, mt_carrer where MT_ALUMNO.codcarpr = mt_carrer.codcarr AND rut = '" + rut + "';"; SqlCommand adoCmd = new System.Data.SqlClient.SqlCommand(sql, adoConn); SqlDataReader adoDR = adoCmd.ExecuteReader(); if (adoDR.HasRows) { if (adoDR.Read()) { if ("".Equals(adoDR["anotit"].ToString()) || "null".Equals(adoDR["anotit"].ToString().ToLower()) || "0".Equals(adoDR["anotit"].ToString())) { if ("".Equals(adoDR["anoegre"].ToString()) || "null".Equals(adoDR["anoegre"].ToString().ToLower()) || "0".Equals(adoDR["anoegre"].ToString())) { cell1.Text = "Sin informaci&oacte;n"; } else { cell1.Text = adoDR["anoegre"].ToString(); } } else { cell1.Text = adoDR["anotit"].ToString(); } cell2.Text = adoDR["nombre_c"].ToString() + "<br />Escuela de Contadores Auditores de Santiago"; cell3.Text = "Profesional"; row.Cells.Add(cell1); row.Cells.Add(cell2); row.Cells.Add(cell3); estudioExtra.Rows.Add(row); } } adoDR.Close(); adoDR = null; adoCmd = null; sql = "SELECT " + tabla + "tipoEstudio.tipo, " + tabla + "estudioExtra.egreso, " + tabla + "estudioExtra.institucion, " + tabla + "estudioExtra.titulo, " + tabla + "estudioExtra.estudioExtraID FROM " + tabla + "estudioExtra, " + tabla + "tipoEstudio WHERE rut = " + rut + " AND " + tabla + "tipoEstudio.tipoEstudioID = " + tabla + "estudioExtra.tipoEstudioID;"; adoCmd = new SqlCommand(sql, adoConn); adoDR = adoCmd.ExecuteReader(); if (adoDR.HasRows) { while (adoDR.Read()) { System.Web.UI.WebControls.TableRow row1 = new System.Web.UI.WebControls.TableRow(); System.Web.UI.WebControls.TableCell cell1_1 = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TableCell cell2_1 = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TableCell cell3_1 = new System.Web.UI.WebControls.TableCell(); cell2_1.Font.Bold = true; cell1_1.Text = adoDR["egreso"].ToString(); cell2_1.Text = adoDR["titulo"].ToString() + "<br />" + adoDR["institucion"].ToString(); cell3_1.Text = adoDR["tipo"].ToString(); row1.Cells.Add(cell1_1); row1.Cells.Add(cell2_1); row1.Cells.Add(cell3_1); System.Web.UI.WebControls.TableCell cellx = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.HyperLink hl = new System.Web.UI.WebControls.HyperLink(); System.Web.UI.WebControls.Image im = new System.Web.UI.WebControls.Image(); im.ImageUrl = "imagenes/cross.png"; im.AlternateText = "Borrar"; hl.Controls.Add(im); hl.NavigateUrl = "borrarEstudio.aspx?rut=" + rut + "&estudioExtraID=" + adoDR["estudioExtraID"].ToString(); System.Web.UI.WebControls.HyperLink h2 = new System.Web.UI.WebControls.HyperLink(); System.Web.UI.WebControls.Image im2 = new System.Web.UI.WebControls.Image(); im2.ImageUrl = "imagenes/page_edit.png"; im2.AlternateText = "Editar"; h2.Controls.Add(im2); h2.NavigateUrl = "agregarEstudio.aspx?rut=" + rut + "&estudioExtraID=" + adoDR["estudioExtraID"].ToString(); // Revision de permisos para usuarios con acceso de solo lectura if (Session["ficha"].ToString().Equals(ConfigurationManager.AppSettings["escritura"].ToString())) { cellx.Controls.Add(hl); cellx.Controls.Add(h2); } cellx.Width = (System.Web.UI.WebControls.Unit) 10; cellx.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Right; row1.Cells.Add(cellx); estudioExtra.Rows.Add(row1); } } }
/// <summary> /// Metodo que crea la tabla mediante una lista de incidencias /// </summary> /// <param></param> /// <returns></returns> public void CrearTabla() { string estilo = string.Empty; TablaIncidenciasFiltrada.Rows.Clear(); if (listaFiltrada != null) { if (listaFiltrada.Any()) { var primerDeLista = listaFiltrada.FirstOrDefault(); //Obtiene el XML de la primera incidencia de la lista var XMLtoTable = primerDeLista.XmlConsulta; TextoCabecero.Text = primerDeLista.Alerta.Descripcion + " - " + primerDeLista.Estatus.Descripcion; XmlDocument xml = new XmlDocument(); xml.LoadXml(XMLtoTable.ToString()); //Obtiene la lista de nodos dentro del xml->table var listaNodosColumnas = xml.FirstChild.ChildNodes; //Crea el cabecero de la tabla en el orden: //Radiobutton - Folio - Organizacion - XML Nodo 1 - XML Nodo 2 - etc TableHeaderRow taRow = new TableHeaderRow(); taRow.TableSection = TableRowSection.TableHeader; TableHeaderCell taCellDatosRadioButton = new TableHeaderCell(); taRow.Cells.Add(taCellDatosRadioButton); TableHeaderCell taCellDatosFechaCreacion = new TableHeaderCell(); taCellDatosFechaCreacion.Text = (string)GetLocalResourceObject("lblFechaCreacionTableHeader"); taRow.Cells.Add(taCellDatosFechaCreacion); TableHeaderCell taCellDatosFechaVencimiento = new TableHeaderCell(); taCellDatosFechaVencimiento.Text = (string)GetLocalResourceObject("lblFechaVencimientoTableHeader"); taRow.Cells.Add(taCellDatosFechaVencimiento); TableHeaderCell taCellDatosFolio = new TableHeaderCell(); taCellDatosFolio.Text = (string)GetLocalResourceObject("lblFolioTableHeader"); taRow.Cells.Add(taCellDatosFolio); TableHeaderCell taCellDatosOrganizacion = new TableHeaderCell(); taCellDatosOrganizacion.Text = (string)GetLocalResourceObject("lblOrganizacionTableHeader"); taRow.Cells.Add(taCellDatosOrganizacion); //Crea una celda por cada nodo en el xml para la cabecera. foreach (XmlNode columna in listaNodosColumnas) { TableHeaderCell taCell = new TableHeaderCell(); var nombreCabecero = columna.Name.Replace('_', ' '); taCell.Text = nombreCabecero; taRow.Cells.Add(taCell); } //Agrega la fila cabecero creada dinamicamente a la tabla TablaIncidenciasFiltrada.Rows.Add(taRow); //Por cada registro en la listafiltrada llenará los valores en la tabla foreach (var incidencia in listaFiltrada) { TableRow taRowDatos = new TableRow(); //Si el usuario responsable es diferente de 0 (La incidencia tiene seguimiento) estilo = string.Empty; if ((incidencia.UsuarioResponsable.UsuarioID != 0 && incidencia.Alerta.ConfiguracionAlerta.NivelAlerta.NivelAlertaId == nivelAlertaUsuario && primerDeLista.Estatus.EstatusId == Estatus.VenciAlert.GetHashCode()) || (primerDeLista.Estatus.EstatusId == Estatus.NuevaAlert.GetHashCode() && incidencia.UsuarioResponsable.UsuarioID == usuarioSeguridad.Usuario.UsuarioID)) { estilo = "incidenciasConSeguimiento"; } if (primerDeLista.Estatus.EstatusId == Estatus.RechaAlert.GetHashCode() && incidencia.UsuarioResponsable.UsuarioID == usuarioSeguridad.Usuario.UsuarioID) { estilo = "incidenciasRechazadas"; } taRowDatos.CssClass = estilo; //Se crea una celda para el radiobutton el cual contendrá el id de la incidencia TableCell taCellDatosRadioButtonValor = new TableCell(); taCellDatosRadioButtonValor.CssClass = estilo; taCellDatosRadioButtonValor.Text = "<input type=\"radio\" class=\"radioIncidencia\" name=\"incidenciaID\" value=\"" + incidencia.IncidenciasID + "\">"; taRowDatos.Cells.Add(taCellDatosRadioButtonValor); //Se crea una celda para fecha de la incidencia TableCell taCellDatosFechaValor = new TableCell(); taCellDatosFechaValor.CssClass = estilo; taCellDatosFechaValor.Text = incidencia.Fecha.ToString(); taRowDatos.Cells.Add(taCellDatosFechaValor); //Se crea una celda para la fecha vigencia de la incidencia TableCell taCellDatosFechaVencimientoValor = new TableCell(); taCellDatosFechaVencimientoValor.ID = "fechavencimiento"; taCellDatosFechaVencimientoValor.CssClass = estilo; taCellDatosFechaVencimientoValor.Text = incidencia.FechaVencimiento.ToString(); taRowDatos.Cells.Add(taCellDatosFechaVencimientoValor); //Se crea una celda para el folio de la incidencia TableCell taCellDatosFolioValor = new TableCell(); taCellDatosFolioValor.CssClass = estilo; taCellDatosFolioValor.Text = incidencia.Folio.ToString(); taRowDatos.Cells.Add(taCellDatosFolioValor); //Se crea una celda para la organizacion de la incidencia TableCell taCellDatosOrganizacionValor = new TableCell(); taCellDatosOrganizacionValor.CssClass = estilo; taCellDatosOrganizacionValor.Text = incidencia.Organizacion.Descripcion; taRowDatos.Cells.Add(taCellDatosOrganizacionValor); //Lee el xml para convertir los valores en celdas XmlDocument xmlIncidencia = new XmlDocument(); xmlIncidencia.LoadXml(incidencia.XmlConsulta.ToString()); var listaNodosDatos = xmlIncidencia.FirstChild.ChildNodes; foreach (XmlNode valor in listaNodosDatos) { TableCell taCellDatos = new TableCell(); taCellDatos.CssClass = estilo; taCellDatos.Text = valor.InnerText; taRowDatos.Cells.Add(taCellDatos); } //Agrega una lista de valores al cuerpo de la tabla TablaIncidenciasFiltrada.Rows.Add(taRowDatos); } } } }
/// <summary> /// Fill Table According to data /// <note type="note"> /// The table should has one template row with cells and controls already. /// And the template row will be removed automatically. /// The data should in the order of the table column. /// </note> /// </summary> /// <param name="t">Table</param> /// <param name="dt">DataBase</param> /// <param name="templateRowIndex">templateRowIndex, default is 1</param> /// <example> /// <code> /// <asp:Table ID="TableScoreExchangeInfo" runat="server" CssClass="table borderTopCorner borderAround" CellPadding="0" CellSpacing="0" ForeColor="Black" BorderStyle="None" /// BorderColor="White" BackColor="White" style="text-overflow:ellipsis;overflow:auto;" OnPreRender="TableScoreExchangeInfo_OnPreRender"> /// <asp:TableRow ID="TableRow32" runat="server" CssClass="tableOddRow" Height="27px"> /// <asp:TableCell ID="TableCell100" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="tableHeaderRow borderAround" BackColor="White"> /// <asp:Label ID="Label63" runat="server" Text="积分卡" CssClass="padding0px2px0px2px"></asp:Label> /// </asp:TableCell> /// <asp:TableCell ID="TableCell101" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="tableHeaderRow borderAround" BackColor="White"> /// <asp:Label ID="Label64" runat="server" Text="兑换类型" CssClass="padding0px2px0px2px"></asp:Label> /// </asp:TableCell> /// <asp:TableCell ID="TableCell102" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="tableHeaderRow borderAround" BackColor="White"> /// <asp:Label ID="Label65" runat="server" Text="兑换积分" CssClass="padding0px2px0px2px"></asp:Label> /// </asp:TableCell> /// <asp:TableCell ID="TableCell103" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="tableHeaderRow borderAround" BackColor="White"> /// <asp:Label ID="Label66" runat="server" Text="兑换礼品" CssClass="padding0px2px0px2px"></asp:Label> /// </asp:TableCell> /// <asp:TableCell ID="TableCell104" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="tableHeaderRow borderAround" BackColor="White"> /// <asp:Label ID="Label67" runat="server" Text="重打印兑换单" CssClass="padding0px2px0px2px"></asp:Label> /// </asp:TableCell> /// </asp:TableRow> /// <asp:TableRow ID="TableRow31" runat="server" CssClass="tableOddRow" Height="27px"> /// <asp:TableCell ID="TableCell69" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="borderAround" BackColor="White"> /// <asp:Label ID="Label34" runat="server" Text="" CssClass="padding0px2px0px2px"></asp:Label> /// </asp:TableCell> /// <asp:TableCell ID="TableCell73" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="borderAround" BackColor="White"> /// <asp:Label ID="Label38" runat="server" Text="" CssClass="padding0px2px0px2px"></asp:Label> /// </asp:TableCell> /// <asp:TableCell ID="TableCell74" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="borderAround" BackColor="White"> /// <asp:Label ID="Label39" runat="server" Text="" CssClass="padding0px2px0px2px"></asp:Label> /// </asp:TableCell> /// <asp:TableCell ID="TableCell79" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="borderAround" BackColor="White"> /// <asp:Label ID="Label44" runat="server" Text="" CssClass="padding0px2px0px2px"></asp:Label> /// </asp:TableCell> /// <asp:TableCell ID="TableCell95" runat="server" ColumnSpan="1" HorizontalAlign="Center" CssClass="borderAround" BackColor="White"> /// <asp:Label ID="Label62" runat="server" Text="" CssClass="padding0px2px0px2px"></asp:Label> /// </asp:TableCell> /// </asp:TableRow> /// </asp:Table> /// </code> /// <code> /// RF.GlobalClass.WebForm.fillTableAccordingToData(TableScoreExchangeInfo, dataSet.Tables["ScoreData", "ScoreDetails"]); /// </code> /// </example> public static void fillTableAccordingToData(Table t, DataTable dt, DataTable dtInfo = null, int templateRowIndex = 1, int templateFooterRowIndex = -1, String ellipsisTitle = "{ellipsis}", String ellipsisCls = "Ellipsis") { if (null == t || null == dt) { return; } else { } try { TableRow[] trs = new TableRow[] { }; List <TableRow> ltr = new List <TableRow>(); TableRow tr; TableCell tc; #region draw table DataRow dr; int dtRowsCount = dt.Rows.Count; int drItemArrayLength; TableRow tempTableRow = t.Rows[templateRowIndex]; int cellsCount = tempTableRow.Cells.Count; TableCell tempTableCell; AttributeCollection act = tempTableRow.Attributes; for (int dti = 0; dti < dtRowsCount; dti++) { dr = dt.Rows[dti]; tr = new System.Web.UI.WebControls.TableRow(); drItemArrayLength = dr.ItemArray.Length; #region copy style System.Collections.ICollection attrKeys = act.Keys; string[] keys = new string[] { }; attrKeys.CopyTo(keys, 0); int keysLength = keys.Length; string keyName = String.Empty; for (int ki = 0; ki < keysLength; ki++) { keyName = keys[ki]; tr.Attributes.Add(keyName, act[keyName]); } tr.CssClass = tempTableRow.CssClass; tr.Height = tempTableRow.Height; tr.Width = tempTableRow.Width; tr.Style.Value = tempTableRow.Style.Value; keys = new string[] { }; tempTableRow.Style.Keys.CopyTo(keys, 0); keysLength = keys.Length; for (int ki = 0; ki < keysLength; ki++) { keyName = keys[ki]; tr.Style.Add(keyName, tempTableRow.Style[keyName]); } tr.ToolTip = tempTableRow.ToolTip; #endregion for (int dri = 0; dri < cellsCount; dri++) { tempTableCell = tempTableRow.Cells[dri]; tc = new System.Web.UI.WebControls.TableCell(); #region copy cell controls System.Web.UI.ControlCollection tempTableCellControls = tempTableCell.Controls; foreach (Control control in tempTableCellControls) { Control _c = RF.GlobalClass.WebForm.ControlCollection.CloneControl(control); if (null != _c) { tc.Controls.Add(_c); } else { } } #endregion #region bind data if (dri < drItemArrayLength && tc.Controls.Count > 0) { try { (tc.Controls[0] as ITextControl).Text = dr.ItemArray.GetValue(dri) as String; if ((tc.Controls[0] as WebControl).CssClass.Split(' ').Contains <string>(ellipsisCls)) { if ((tc.Controls[0] as WebControl).ToolTip.Contains(ellipsisTitle)) { (tc.Controls[0] as WebControl).ToolTip = (tc.Controls[0] as WebControl).ToolTip.Replace(ellipsisTitle, (tc.Controls[0] as ITextControl).Text); } else if ((tc.Controls[0] as WebControl).ToolTip == String.Empty) { (tc.Controls[0] as WebControl).ToolTip = (tc.Controls[0] as ITextControl).Text; } else { } } else { } } catch (Exception ex) { } } else { } #endregion #region customized attributes keys = new string[] { }; tempTableCell.Attributes.Keys.CopyTo(keys, 0); keysLength = keys.Length; for (int ki = 0; ki < keysLength; ki++) { keyName = keys[ki]; tc.Attributes.Add(keyName, tempTableCell.Attributes[keyName]); } #endregion #region copy cell style tc.CssClass = tempTableCell.CssClass; tc.Height = tempTableCell.Height; tc.Width = tempTableCell.Width; keys = new string[] { }; tempTableCell.Style.Keys.CopyTo(keys, 0); keysLength = keys.Length; for (int ki = 0; ki < keysLength; ki++) { keyName = keys[ki]; tc.Style.Add(keyName, tempTableCell.Style[keyName]); } tc.ColumnSpan = tempTableCell.ColumnSpan; tc.RowSpan = tempTableCell.RowSpan; tc.BackColor = tempTableCell.BackColor; tc.ToolTip = tempTableCell.ToolTip; #endregion tr.Cells.Add(tc); } t.Rows.AddAt(templateRowIndex, tr); ltr.Add(tr); } /* * trs = ltr.ToArray(); * if (t.Rows.Count > 2) * { * TableRow[] ltra = new TableRow[(t.Rows.Count - 2)]; * t.Rows.CopyTo(ltra, 0); * trs = trs.Concat<TableRow>(ltra).ToArray(); * } * else { } * t.Rows.AddRange(trs); */ t.Rows.Remove(tempTableRow); #endregion #region draw table info if (t.Rows.Count >= dtRowsCount + 2) { if (templateFooterRowIndex > 0 && t.Rows.Count > templateFooterRowIndex) { // dtRowsCount + 1 : consider there is a header. TableRow tempTableFooterRow = t.Rows[dtRowsCount + 1]; dtInfo = dtInfo ?? new DataTable(); Boolean tmpBool = true; dtInfo.Rows[0].ItemArray.Select(delegate(object obj, int idx) { foreach (Control c in tempTableFooterRow.Controls) { switch (idx) { case 0: if (true == (c as WebControl).CssClass.Contains("RowTotalCount")) { (c as ITextControl).Text = obj + ""; } else { } break; case 1: if (true == (c as WebControl).CssClass.Contains("PerPageRowCount")) { (c as ITextControl).Text = obj + ""; } else { } break; case 2: if (true == (c as WebControl).CssClass.Contains("PageTotalCount")) { (c as ITextControl).Text = obj + ""; } else { } break; case 3: if (true == (c as WebControl).CssClass.Contains("pageFirst")) { tmpBool = (c as WebControl).Enabled = Boolean.TryParse(obj.ToString(), out tmpBool) ? tmpBool : tmpBool; } else { } break; case 4: if (true == (c as WebControl).CssClass.Contains("pagePrev")) { tmpBool = (c as WebControl).Enabled = Boolean.TryParse(obj.ToString(), out tmpBool) ? tmpBool : tmpBool; } else { } break; case 5: if (true == (c as WebControl).CssClass.Contains("pageNext")) { tmpBool = (c as WebControl).Enabled = Boolean.TryParse(obj.ToString(), out tmpBool) ? tmpBool : tmpBool; } else { } break; case 6: if (true == (c as WebControl).CssClass.Contains("pageLast")) { tmpBool = (c as WebControl).Enabled = Boolean.TryParse(obj.ToString(), out tmpBool) ? tmpBool : tmpBool; } else { } break; case 7: if (true == (c as WebControl).CssClass.Contains("CurrPageNum")) { (c as ITextControl).Text = obj + ""; } else { } break; default: break; } } return(obj); }); } else { } } else { } #endregion } catch (Exception ex) { } }
private void CreateTabs() { System.Data.DataRow[] tabRows; System.Web.UI.WebControls.Table innerTable; System.Web.UI.WebControls.TableCell tableCell; System.Web.UI.WebControls.TableCell parentTableCell; System.Web.UI.WebControls.TableRow tableRow; System.Web.UI.WebControls.TableRow parentTableRow; System.Web.UI.Control control; for (int i = 0; i < 30; i++) { tabRows = _tabsDataSet.Tabs.Select("Level=" + i.ToString()); if (tabRows.Length == 0) { break; } parentTableRow = new System.Web.UI.WebControls.TableRow(); ParentTable.Rows.Add(parentTableRow); parentTableCell = new System.Web.UI.WebControls.TableCell(); parentTableRow.Cells.Add(parentTableCell); innerTable = new System.Web.UI.WebControls.Table(); innerTable.CellPadding = 0; innerTable.CellSpacing = 0; parentTableCell.Controls.Add(innerTable); tableRow = new System.Web.UI.WebControls.TableRow(); innerTable.Rows.Add(tableRow); foreach (System.Data.DataRow row in tabRows) { tableCell = new System.Web.UI.WebControls.TableCell(); tableRow.Cells.Add(tableCell); control = LoadControl("Tab.ascx"); //adding images foreach (System.Data.DataRow imagesRow in _tabsDataSet.TabImages.Select("TabId=" + row["Id"].ToString())) { ((Tab)control).AddImage(imagesRow["ImageUrl"].ToString()); } // if (i == 0) { ((Tab)control).IsRoot = true; } ((Tab)control).Caption = (string)row["Caption"]; ((Tab)control).IsActive = (bool)row["IsActive"]; ((Tab)control).IsButton = (bool)row["IsButton"]; ((Tab)control).Id = (int)row["Id"]; ((Tab)control).Href = row["Href"].ToString(); ((Tab)control).CssStyleNum = this.CssStyleNum; tableCell.Controls.Add(control); } tableCell = new System.Web.UI.WebControls.TableCell(); tableCell.Width = System.Web.UI.WebControls.Unit.Percentage(100); tableCell.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Right; tableRow.Cells.Add(tableCell); Space space = (Space)LoadControl("Space.ascx"); if (i == 0) { space.IsRoot = true; } space.EnableLogoutButton = this.EnableLogoutButton; space.LogoutHref = this.LogoutHref; space.WelcomeNote = this.WelcomeNote; space.CssStyleNum = this.CssStyleNum; tableCell.Controls.Add(space); } }
public static System.Web.UI.WebControls.Table CodesPackagingList(string shipName, string infoText, List <BoxItemInfo> lbii, int tabWidht, params string[] BoxItemInfoColumns) { if (BoxItemInfoColumns.Length % 2 != 0) { throw new Exception("Numero parametri non valido."); } for (int ex = 0; ex < BoxItemInfoColumns.Length / 2; ex++) { if ((typeof(BoxItemInfo)).GetProperty(BoxItemInfoColumns[ex]) == null) { throw new Exception("Parametro " + BoxItemInfoColumns[ex] + " non valido in Box."); } } int startProp = 0; int maxProp = BoxItemInfoColumns.Length / 2; int startHeader = BoxItemInfoColumns.Length / 2; int maxHeader = BoxItemInfoColumns.Length; System.Web.UI.WebControls.Table tab = new System.Web.UI.WebControls.Table(); tab.Width = tabWidht; tab.CellPadding = 3; tab.CellSpacing = 3; System.Web.UI.WebControls.TableRow tr; System.Web.UI.WebControls.TableCell tc; /// INTESTAZIONE: tr = new System.Web.UI.WebControls.TableRow(); tc = new System.Web.UI.WebControls.TableCell(); tc.Text = "Spedizione n.# " + shipName; tc.Font.Bold = true; tc.Font.Size = 16; tc.ColumnSpan = 5; tc.BorderWidth = 1; tr.Cells.Add(tc); tab.Rows.Add(tr); tr = new System.Web.UI.WebControls.TableRow(); tc = new System.Web.UI.WebControls.TableCell(); //tc.Text = "codici con errore: " + lbii.Count.ToString(); tc.Text = infoText + lbii.Count.ToString(); tc.Font.Bold = true; tc.Font.Size = 14; tc.ColumnSpan = 5; tc.BorderWidth = 1; tr.Cells.Add(tc); tab.Rows.Add(tr); tr = new System.Web.UI.WebControls.TableRow(); tc = new System.Web.UI.WebControls.TableCell(); tc.Text = ""; tc.ColumnSpan = 5; tr.Cells.Add(tc); tab.Rows.Add(tr); /// Table HEADER tr = new System.Web.UI.WebControls.TableRow(); for (int px = startHeader; px < maxHeader; px++) { tc = new System.Web.UI.WebControls.TableCell(); tc.Text = BoxItemInfoColumns[px]; tc.Font.Bold = true; tc.Font.Size = 12; tc.BorderWidth = 1; tr.Cells.Add(tc); } tab.Rows.Add(tr); int i = 0; foreach (BoxItemInfo bi in lbii) { tr = new System.Web.UI.WebControls.TableRow(); for (int px = startProp; px < maxProp; px++) { tc = new System.Web.UI.WebControls.TableCell(); tc.Text = bi.GetType().GetProperty(BoxItemInfoColumns[px]).GetValue(bi, null).ToString(); tc.Font.Size = 11; tc.BorderWidth = 1; tr.Cells.Add(tc); } tr.BackColor = (i % 2 == 0) ? System.Drawing.Color.LightGray : System.Drawing.Color.White; tr.Cells[0].Font.Bold = true; tr.Cells[maxProp - 2].HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center; tr.Cells[maxProp - 1].HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center; tr.Cells[maxProp - 2].Font.Size = 14; tr.Cells[maxProp - 1].Font.Size = 14; tr.Cells[maxProp - 3].Font.Bold = tr.Cells[maxProp - 2].Font.Bold = tr.Cells[maxProp - 1].Font.Bold = true; tab.Rows.Add(tr); i++; } return(tab); }
public List <System.Web.UI.WebControls.Table> BoxesContainsNames(string codice, params string[] BoxItemColumns) { List <int> listaBoxInd = BoxContainsNames(codice); Box box; List <System.Web.UI.WebControls.Table> tabList = new List <System.Web.UI.WebControls.Table>(); foreach (int p in listaBoxInd) { box = this.Boxes[p]; if (BoxItemColumns.Length % 2 != 0) { throw new Exception("Numero parametri non valido."); } for (int ex = 0; ex < BoxItemColumns.Length / 2; ex++) { if ((typeof(BoxItem)).GetProperty(BoxItemColumns[ex]) == null) { throw new Exception("Parametro " + BoxItemColumns[ex] + " non valido in Box."); } } System.Web.UI.WebControls.Table tab = new System.Web.UI.WebControls.Table(); tab.CellPadding = 3; tab.CellSpacing = 3; System.Web.UI.WebControls.TableRow tr; System.Web.UI.WebControls.TableCell tc; /// INTESTAZIONE: tr = new System.Web.UI.WebControls.TableRow(); tc = new System.Web.UI.WebControls.TableCell(); tc.Text = "Spedizione n.# " + box.shipName; tc.Font.Bold = true; tc.Font.Size = 16; tc.ColumnSpan = BoxItemColumns.Length; tc.BorderWidth = 1; tr.Cells.Add(tc); tab.Rows.Add(tr); tr = new System.Web.UI.WebControls.TableRow(); tc = new System.Web.UI.WebControls.TableCell(); tc.Text = "Box n.# " + box.id.ToString(); tc.Font.Bold = true; tc.Font.Size = 14; tc.ColumnSpan = BoxItemColumns.Length; tc.BorderWidth = 1; tr.Cells.Add(tc); tab.Rows.Add(tr); tr = new System.Web.UI.WebControls.TableRow(); tc = new System.Web.UI.WebControls.TableCell(); tc.Text = ""; tc.ColumnSpan = BoxItemColumns.Length; tr.Cells.Add(tc); tab.Rows.Add(tr); /// Table HEADER tr = new System.Web.UI.WebControls.TableRow(); for (int px = BoxItemColumns.Length / 2; px < BoxItemColumns.Length; px++) { tc = new System.Web.UI.WebControls.TableCell(); tc.Text = BoxItemColumns[px]; tc.BorderWidth = 1; tr.Cells.Add(tc); } tab.Rows.Add(tr); int i = 0; foreach (BoxItem bi in box.Items) { tr = new System.Web.UI.WebControls.TableRow(); for (int px = 0; px < BoxItemColumns.Length / 2; px++) { tc = new System.Web.UI.WebControls.TableCell(); tc.Text = bi.GetType().GetProperty(BoxItemColumns[px]).GetValue(bi, null).ToString(); tc.BorderWidth = 1; tr.Cells.Add(tc); } tr.BackColor = (i % 2 == 0) ? System.Drawing.Color.LightGray : System.Drawing.Color.White; tr.Cells[0].Font.Bold = true; tab.Rows.Add(tr); i++; } tabList.Add(tab); } return(tabList); }
public void GetBook(string name) { string envid = ConfigurationManager.AppSettings["envid"]; int booknum = int.Parse(ConfigurationManager.AppSettings["booknum"]); //string name = Request.QueryString["BookName"]; int skip = booknum * ((int)Session["CurrentPage"] - 1); string queryString = ""; if (name == "") { queryString = "{\"env\":\"" + envid + "\", \"query\": \"db.collection(\\\"library\\\").where({}).limit(" + booknum + ").skip(" + skip + ").get()\"}"; } else { queryString = "{\"env\":\"" + envid + "\", \"query\": \"db.collection(\\\"library\\\").where({name:db.RegExp({regexp:\\\"" + name + "\\\" ,option:\\\"i\\\"})}).limit(" + booknum + ").skip(" + skip + ").get()\"}"; } //access_token //MessageBox.Show(queryString); string access_token = (string)Session["access_token"]; string url = "https://api.weixin.qq.com/tcb/databasequery?access_token=" + access_token; //POST到网站 string Message = OperateCloud.Query(queryString, url); JObject jo = OperateCloud.GetJson(Message); //MessageBox.Show("errcode:" + jo["errcode"].ToString()); int limit = int.Parse(jo["pager"]["Limit"].ToString()); int total = int.Parse(jo["pager"]["Total"].ToString()); //MessageBox.Show("total"+total+"limit"+limit); if (total % booknum != 0) { Session["Count"] = total / booknum + 1; count.Text = Session["Count"] + ""; } else { Session["Count"] = total / booknum; count.Text = Session["Count"] + ""; } //MessageBox.Show("count:"+Session["Count"]); //List<string> filelist = new List<string>(); int loop = 0; if (limit < total - skip) { loop = limit; } else { loop = total - skip; } for (int i = 0; i < loop; i++) { string temp = jo["data"][i].ToString(); JObject jo1 = OperateCloud.GetJson(temp); //MessageBox.Show(jo1["name"].ToString()); queryString = "{\"env\":\"" + envid + "\", \"file_list\": [{\"fileid\":\"" + jo1["fileIDs"][0].ToString() + "\",\"max_age\":7200}]}"; //access_token url = "https://api.weixin.qq.com/tcb/batchdownloadfile?access_token=" + access_token; //POST到网站 Message = OperateCloud.Query(queryString, url); JObject jo2 = OperateCloud.GetJson(Message); int errorcode = int.Parse(jo2["errcode"].ToString()); if (errorcode == 0) { /*MessageBox.Show("获取图片成功"); * MessageBox.Show(jo2["file_list"][0]["download_url"].ToString());*/ TableRow row = new TableRow(); TableCell cell3 = new TableCell(); cell3.Text = "<p style='width:100px;padding-left:30px' class='overline'>" + jo1["remain"].ToString() + "</ p>"; row.Cells.Add(cell3); TableCell cell1 = new TableCell(); cell1.Text = "<p style='width:100px;padding:10px' class='overline'>" + jo1["name"].ToString() + "</ p>"; row.Cells.Add(cell1); TableCell cell0 = new TableCell(); cell0.Text = "<img style='width:120px;height:160px' src='" + jo2["file_list"][0]["download_url"].ToString() + "'/>"; row.Cells.Add(cell0); TableCell cell6 = new TableCell(); cell6.Text = "<p style='width:500px;padding:40px' class='overline'>" + jo1["description"].ToString() + "</ p>"; row.Cells.Add(cell6); TableCell cell2 = new TableCell(); cell2.Text = "<p style='width:200px;padding:10px' class='overline'>" + jo1["author"].ToString() + "</ p>"; row.Cells.Add(cell2); TableCell cell4 = new TableCell(); cell4.Text = "<p style='width:100px;padding:10px' class='overline'>" + jo1["library"].ToString() + "</ p>"; row.Cells.Add(cell4); TableCell cell5 = new TableCell(); cell5.Text = "<p style='width:100px;padding:10px' class='overline'>" + jo1["place"].ToString() + ":" + jo1["label"].ToString() + "</ p>"; row.Cells.Add(cell5); MyTable.Rows.Add(row); } } /*foreach(string i in filelist) * { * MessageBox.Show(i); * }*/ }
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; }