/// <summary> /// select the table to show from the db and build the table in the page /// </summary> protected void ShowCampaignTable() { Campaign cam = new Campaign(); List<Campaign> campaigns = cam.GetCampaignList(email); foreach (Campaign c in campaigns) { HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell tc = new HtmlTableCell(); HtmlTableCell tc1 = new HtmlTableCell(); HtmlTableCell tc2 = new HtmlTableCell(); HtmlTableCell tc3 = new HtmlTableCell(); HtmlTableCell tc4 = new HtmlTableCell(); HtmlTableCell tc5 = new HtmlTableCell(); tc.InnerHtml = c.Name; tc1.InnerHtml = c.DateCreated.ToString(); tc2.InnerHtml = c.Id.ToString(); tc3.InnerHtml = c.Voucher; tc4.InnerHtml = c.ShareCount.ToString(); if (c.IsActive == true) tc5.InnerHtml = "פעיל"; else tc5.InnerHtml = "לא פעיל"; tr.Cells.Add(tc); tr.Cells.Add(tc1); tr.Cells.Add(tc2); tr.Cells.Add(tc3); tr.Cells.Add(tc4); tr.Cells.Add(tc5); campaignsData.Controls.Add(tr); } }
private static void CreateTableRow(HtmlTable table, Post post) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell date = new HtmlTableCell(); date.InnerHtml = post.DateCreated.ToString("yyyy-MM-dd"); date.Attributes.Add("class", "date"); row.Cells.Add(date); HtmlTableCell title = new HtmlTableCell(); title.InnerHtml = string.Format("<a href=\"{0}\">{1}</a>", post.RelativeLink, post.Title); title.Attributes.Add("class", "title"); row.Cells.Add(title); if (BlogSettings.Instance.IsCommentsEnabled) { HtmlTableCell comments = new HtmlTableCell(); comments.InnerHtml = post.ApprovedComments.Count.ToString(); comments.Attributes.Add("class", "comments"); row.Cells.Add(comments); } if (BlogSettings.Instance.EnableRating) { HtmlTableCell rating = new HtmlTableCell(); rating.InnerHtml = post.Raters == 0 ? "None" : Math.Round(post.Rating, 1).ToString(); rating.Attributes.Add("class", "rating"); row.Cells.Add(rating); } table.Rows.Add(row); }
public void ContHTML() { for (int i = 0; i < ContListName.Count; i ++ ) { name[i] = ContListName[i] + "<span onclick=ContDelId('" + ContListIdType[i] + "')>" + "</span>"; img[i] = "<input type=image onserverclick=Del_ServerClick src=\\ICBCDynamicSite\\site\\Fund\\Bmp\\FundCompare\\button_delete_off.gif />"; ShowAlert(name[i]); ShowAlert(img[i]); } HtmlTable table = new HtmlTable(); table.Border = 0; table.CellPadding = 0; for (int rowcount = 0; rowcount < name.Length; rowcount ++ ) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell1 = new HtmlTableCell(); HtmlTableCell cell2 = new HtmlTableCell(); cell1.ColSpan = 2; cell1.Align = "Left"; cell2.Align = "Right"; cell1.Controls.Add(new LiteralControl(name[rowcount])); cell2.Controls.Add(new LiteralControl(name[rowcount])); row.Cells.Add(cell1); row.Cells.Add(cell2); table.Rows.Add(row); } Place.Controls.Clear(); Place.Controls.Add(table); }
private HtmlTableRow CreateRow(JobInfo item) { HtmlTableRow row = new HtmlTableRow(); row.Cells.Add(CreateCell(item.NameKey)); row.Cells.Add(CreateCell(item.DataValue)); return row; }
private HtmlTableRow CreateRow(string name, string value) { HtmlTableRow row = new HtmlTableRow(); row.Cells.Add(CreateCell(name)); row.Cells.Add(CreateCell(value)); return row; }
private void AddItem(string prtName, string val) { var tr = new HtmlTableRow(); var td=new HtmlTableCell(); int rc=tbprt.Rows.Count; if (rc > 0)//如果存在行 { if (tbprt.Rows[rc - 1].Cells.Count == 4)//如果最后行已满 { tbprt.Rows.Add(tr);//直接添加一个新行 } else { tr = tbprt.Rows[rc - 1];//将tr设为最后的行 } } else {//如果还没有行 tbprt.Rows.Add(tr); } td.InnerText = prtName; td.Attributes["class"] = "fieldHead"; tr.Cells.Add(td); td = new HtmlTableCell(); td.InnerText = val; tr.Cells.Add(td); }
private void LayoutColumns() { HtmlTableRow tr = new HtmlTableRow(); tr.Attributes["class"] = "ReportLayout"; tblReport.Rows.Add(tr); HtmlTableCell td = new HtmlTableCell(); tr.Cells.Add(td); td.Width = "20px"; td.Height = "0px"; td = new HtmlTableCell(); tr.Cells.Add(td); td.Width = "120px"; td.Height = "0px"; td = new HtmlTableCell(); tr.Cells.Add(td); td.Width = "120px"; td.Height = "0px"; td = new HtmlTableCell(); tr.Cells.Add(td); td.Width = "50px"; td.Height = "0px"; td = new HtmlTableCell(); tr.Cells.Add(td); td.Width = "500px"; td.Height = "0px"; }
public string RenderAccounts(TransitAccount[] accounts) { HtmlTable table = new HtmlTable(); table.Border = 0; table.BorderColor = "White"; HtmlTableRow row = new HtmlTableRow(); table.Rows.Add(row); foreach (TransitAccount ta in accounts) { HtmlTableCell cell = new HtmlTableCell(); cell.Controls.Add(new LiteralControl(string.Format( "<div><a href='AccountView.aspx?id={0}'>" + "<img border=0 style='width: 50%;' src='AccountPictureThumbnail.aspx?id={1}'></a></div>" + "<div class=sncore_link><a href='AccountView.aspx?id={0}'>{2}</a>", ta.Id, ta.PictureId, Render(ta.Name)))); row.Cells.Add(cell); if (row.Cells.Count % 4 == 0) { row = new HtmlTableRow(); table.Rows.Add(row); } } StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); table.RenderControl(new HtmlTextWriter(sw)); return sb.ToString(); }
protected void AddRowIconClassName(string icon, HtmlTable table, HtmlTableRow row) { HtmlTableCell cell1 = new HtmlTableCell(); cell1.InnerHtml = icon; row.Cells.Add(cell1); table.Rows.Add(row); }
protected void Page_Load(object sender, EventArgs e) { //首先创建一个HtmlTable对象 HtmlTable table1 = new HtmlTable(); //设置HtmlTable的格式属性 table1.Border = 1; table1.CellPadding = 1; table1.CellSpacing = 1; table1.BorderColor = "red"; //下面的代码向HtmlTable添加内容 HtmlTableRow row; HtmlTableCell cell; for (int i = 1; i <= 5; i++) { // 创建一个新的行,并设置其背景色属性 row = new HtmlTableRow(); row.BgColor = (i % 2 == 0 ? "lightyellow" : "lightcyan"); for (int j = 1; j <= 4; j++) { //创建一个新的列,为其设置文本 cell = new HtmlTableCell(); cell.InnerHtml = "行: " + i.ToString() + "<br />列: " + j.ToString(); //添加列对象到当前的行 row.Cells.Add(cell); } //添加行对象到当前的Htmltable table1.Rows.Add(row); } //添加HtmlTable到当前页的控件集合中 this.Controls.Add(table1); }
protected override void OnInit(EventArgs e) { string filename = Server.MapPath("settings.xml"); XPathDocument document = new XPathDocument(filename); XPathNavigator navigator = document.CreateNavigator(); XPathExpression expression = navigator.Compile("/appSettings/*"); XPathNodeIterator iterator = navigator.Select(expression); HtmlTable table = new HtmlTable(); HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); string tooltip = ""; try { while (iterator.MoveNext()) { tooltip = ""; row = new HtmlTableRow(); cell = new HtmlTableCell(); XPathNavigator navigator2 = iterator.Current.Clone(); Label label = new Label(); label.ID = navigator2.Name + "Label"; label.Text = navigator2.GetAttribute("name", navigator2.NamespaceURI); tooltip = navigator2.GetAttribute("description", navigator2.NamespaceURI); Control c = null; if (label.ID != "") { c = new TextBox(); c.ID = navigator2.GetAttribute("name", navigator2.NamespaceURI) + "Textbox"; (c as TextBox).Text = navigator2.Value; (c as TextBox).ToolTip = tooltip; (c as TextBox).Width = 700; (c as TextBox).TextMode = TextBoxMode.MultiLine; label.ToolTip = tooltip; } cell.Controls.Add(label); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Controls.Add(c); row.Cells.Add(cell); controls.Add(new ControlListItem(navigator2.Name, c.ID)); table.Rows.Add(row); } } catch (Exception ex) { FormMessage.ForeColor = Color.Red; FormMessage.Text = ex.Message; } ControlsPanel.Controls.Add(table); base.OnInit(e); }
private static HtmlTableRow AddRow(JobControl_Get_Result controlResult) { HtmlTableRow row = new HtmlTableRow(); row.Cells.Add(AddLabel(controlResult.ControlName)); row.Cells.Add(AddControl(controlResult)); return row; }
protected override void Render (HtmlTextWriter writer) { HtmlTableRow row = new HtmlTableRow (); HtmlTableCell cell = new HtmlTableCell (); cell.InnerHtml = "Test cell is visible"; row.Cells.Add (cell); Table1.Rows.Add (row); Table1.Visible = true; Table1.RenderControl (writer); }
protected void Page_Load (object sender, EventArgs e) { GeographyBallotCoverageLookup lookup = GetLookupFromCache(); HtmlTableRow tr = null; HtmlTableCell td = null; tr = new HtmlTableRow(); mainTable.Rows.Add(tr); td = CreateCell(tr, "Geography"); td = CreateCell(tr, "GeographyId"); td = CreateCell(tr, "VoterCount"); td = CreateCell(tr, "AdvanceVotingStationsDistro"); td = CreateCell(tr, "AdvanceVotingStationsTotal"); td = CreateCell(tr, "VotingStationsTotal"); td = CreateCell(tr, "VotingStationsDistroSingle"); td = CreateCell(tr, "VotingStationsDistroDouble"); td = CreateCell(tr, "VotingStationsComplete"); td = CreateCell(tr, "WAdvanceVotingStationsDistro"); td = CreateCell(tr, "WAdvanceVotingStationsTotal"); td = CreateCell(tr, "WWAdvanceVotingStationsDistro"); td = CreateCell(tr, "WWAdvanceVotingStationsTotal"); td = CreateCell(tr, "WVotingStationsTotal"); td = CreateCell(tr, "WVotingStationsDistroSingle"); td = CreateCell(tr, "WVotingStationsDistroDouble"); td = CreateCell(tr, "WVotingStationsComplete"); foreach (int geoId in lookup.Keys) { tr = new HtmlTableRow(); mainTable.Rows.Add(tr); GeographyBallotCoverageDataPoint pt = lookup[geoId]; td = CreateCell(tr, "" + Geography.FromIdentity((pt.GeographyId)).Name); td = CreateCell(tr, "" + pt.GeographyId); td = CreateCell(tr, "" + pt.VoterCount); td = CreateCell(tr, "" + pt.AdvanceVotingStationsDistro); td = CreateCell(tr, "" + pt.AdvanceVotingStationsTotal); td = CreateCell(tr, "" + pt.VotingStationsTotal); td = CreateCell(tr, "" + pt.VotingStationsDistroSingle); td = CreateCell(tr, "" + pt.VotingStationsDistroDouble); td = CreateCell(tr, "" + pt.VotingStationsComplete); td = CreateCell(tr, "" + pt.WAdvanceVotingStationsDistro); td = CreateCell(tr, "" + pt.WAdvanceVotingStationsTotal); td = CreateCell(tr, "" + pt.WWAdvanceVotingStationsDistro); td = CreateCell(tr, "" + pt.WWAdvanceVotingStationsTotal ); td = CreateCell(tr, "" + pt.WVotingStationsTotal); td = CreateCell(tr, "" + pt.WVotingStationsDistroSingle); td = CreateCell(tr, "" + pt.WVotingStationsDistroDouble); td = CreateCell(tr, "" + pt.WVotingStationsComplete); } }
private HtmlTableRow CreateAssetRow(JobAsset item, HttpServerUtility server) { HtmlTableRow row = new HtmlTableRow(); string filename = Path.GetFileName(item.Filepath); row.Cells.Add(CreateCell("Job Asset: " + filename)); HtmlTableCell cell = new HtmlTableCell(); cell = new HtmlTableCell(); string url = WebUtils.ResolveVirtualPath(item.Filepath).Replace("~", ".."); cell.InnerHtml = String.Format("<a href=\"{0}\" target=\"blank\">{1}</a>", url, "Open File"); row.Cells.Add(cell); return row; }
protected void Page_Load(object sender, EventArgs e) { if ( !IsPostBack ) { IDataReader reader = (IDataReader)dsRegister.Select(new DataSourceSelectArguments()); try { while (reader.Read()) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); cell.InnerText = reader["DepName"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); cell = new HtmlTableCell(); cell.InnerText = reader["ToolName"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); cell = new HtmlTableCell(); cell.InnerText = reader["PersName"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); cell = new HtmlTableCell(); cell.InnerText = reader["ManufName"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); cell = new HtmlTableCell(); cell.InnerText = reader["CouName"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); cell = new HtmlTableCell(); cell.InnerText = reader["MarkName"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); cell = new HtmlTableCell(); cell.InnerText = reader["Count_l"].ToString(); row.Cells.Add(cell); TableViewRegister.Rows.Add(row); } } finally { reader.Close(); } } }
protected void OutputSuggestedResults() { try { ISuggestedResults suggestedResults = ObjectFactory.GetSuggestedResults(); List<SuggestedResultSet> suggestedResultsSets = suggestedResults.GetList(); foreach (SuggestedResultSet suggestedResultSet in suggestedResultsSets) { // Create the table row for this suggested result set. HtmlTableRow row = new HtmlTableRow(); HtmlTableCell phraseCell = new HtmlTableCell(); HtmlTableCell resultsCell = new HtmlTableCell(); row.Cells.Add(phraseCell); row.Cells.Add(resultsCell); // Add hyperlink for viewing the result set details. HyperLink viewSetLink = new HyperLink(); viewSetLink.NavigateUrl = string.Format(ViewSuggestedResultSetUrlFormat, Server.HtmlEncode(suggestedResultSet.Id.ToString())); viewSetLink.Text = Server.HtmlEncode(suggestedResultSet.Name); phraseCell.Controls.Add(viewSetLink); foreach (SuggestedResult suggestedResult in suggestedResultSet.SuggestedResults) { if (resultsCell.Controls.Count > 0) { Literal seperator = new Literal(); seperator.Text = ", "; resultsCell.Controls.Add(seperator); } HyperLink suggestedResultLink = new HyperLink(); suggestedResultLink.NavigateUrl = suggestedResult.Url; suggestedResultLink.Text = Server.HtmlEncode(suggestedResult.Title); suggestedResultLink.Attributes.Add("onclick", OpenInNewWindowScript); resultsCell.Controls.Add(suggestedResultLink); } tblSuggestedResultSets.Rows.Add(row); } } catch { Utilities.ShowError(messageHelper.GetMessage("msg search suggested results connection error")); } }
private void LoadCities() { City c = new City(); if (c.LoadByCountryID(CountryID)) { do { HtmlTableRow row = new HtmlTableRow(); row.Cells.Add(AddCityCellInnerHTML(c.GetColumn("Name" + Utils.LangPrefix).ToString(), c.GetColumn("CountryName").ToString(), c.GetColumn("Name_en").ToString())); tblCities.Rows.Add(row); } while (c.MoveNext()); } }
private void LoadGallery() { Gallery g = new Gallery(); g.Where.CategoryID.Value = CategoryID; if (g.Query.Load()) { HtmlTableRow row = new HtmlTableRow(); do { Image i = new Image(); i.ImageUrl = Path.Combine(Utils.GaleryImagePath, g.PhotoName); gallery.Controls.Add(i); } while (g.MoveNext()); } }
private void InsertC() { //实例化ArrayList ArrayList AL = new ArrayList(); this.Tab_UpDownFile.Rows.Clear(); //清除id为F表格里的所有行 //表示 HtmlTable 控件中的 <tr> HTML 元素 HtmlTableRow HTR = new HtmlTableRow(); //表示 HtmlTableRow 对象中的 <td> 和 <th> HTML 元素 HtmlTableCell HTC = new HtmlTableCell(); //在单元格中添加一个FileUpload控件 HTC.Controls.Add(new FileUpload()); //在行中添加单元格 HTR.Controls.Add(HTC); //在表中添加行 Tab_UpDownFile.Rows.Add(HTR); SFUPC(); }
public static HtmlTable BuildDefaultCopies() { HtmlTable oTable = new HtmlTable() { Width = "30%", Align = "right" }; oTable.Style.Add("font-family", "Arial (Hebrew)"); oTable.Style.Add("font-size", "11pt"); oTable.Style.Add("font-style", "normal"); HtmlTableRow oRow = new HtmlTableRow(); HtmlTableCell oCell = new HtmlTableCell(); oCell.Attributes.Add("class", "clsUnderLineText"); oCell.InnerHtml = "העתקים:"; oRow.Cells.Add(oCell); oTable.Rows.Add(oRow); return oTable; }
HtmlTableRow BuildNewRow(string Cell1Text, string Cell2Text) { //必須用到 using System.Web.UI.HtmlControls;。 HtmlTableRow row = new HtmlTableRow(); //-- 新的一列 HtmlTableCell cell1 = new HtmlTableCell(); //-- 新的儲存格 HtmlTableCell cell2 = new HtmlTableCell(); cell1.Controls.Add(new LiteralControl(Cell1Text)); cell1.Width = "20px"; cell1.Style.Add("border-bottom", "1px dotted black"); row.Cells.Add(cell1); cell2.Controls.Add(new LiteralControl(Cell2Text)); cell2.Width = "100px"; cell2.Style.Add("border-bottom", "1px dotted black"); row.Cells.Add(cell2); return row; //--回傳一個 HtmlTableRow }
protected void Page_Load(object sender, EventArgs e) { HtmlTable myTable = new HtmlTable(); myTable.Border = 1; myTable.CellPadding = 3; myTable.CellSpacing = 3; for (int i = 0; i < 3; i++) { HtmlTableRow myRow = new HtmlTableRow(); for (int j = 0; j < 4; j++) { HtmlTableCell myCell = new HtmlTableCell(); myCell.InnerHtml = i + ", " + j; myRow.Cells.Add(myCell); } myTable.Rows.Add(myRow); } Page.Controls.Add(myTable); }
protected void AddRadToggleButtonWithIcon(string ID, string IconName, string Skin, int? Height, int? Top, HtmlTable table, HtmlTableRow row) { HtmlTableCell cell = new HtmlTableCell(); RadToggleButton RadToggleButton1 = new RadToggleButton() { ID = "RadToggleButton1" + ID, Text = IconName, Skin = Skin, }; if (Height != null) RadToggleButton1.Height = Unit.Pixel((int)Height); RadToggleButton1.Icon.CssClass = IconName; if (Top != null) RadToggleButton1.Icon.Top = Unit.Pixel((int)Top); cell.Controls.Add(RadToggleButton1); row.Cells.Add(cell); table.Rows.Add(row); }
//抬頭 private string GetRptHead() { string strTemp = ""; HtmlTable table = new HtmlTable(); HtmlTableRow row; HtmlTableCell cell; CssStyleCollection css; FontSize = "14px"; table.Border = 0; table.CellPadding = 0; table.CellSpacing = 0; table.Align = "center"; css = table.Style; css.Add("font-size", "12px"); css.Add("font-family", "標楷體"); css.Add("width", "100%"); //-------------------------------------------- row = new HtmlTableRow(); cell = new HtmlTableCell(); strTemp = "103年熱線志工班表 第一季 "; cell.InnerHtml = strTemp == "" ? " " : strTemp; css = cell.Style; css.Add("text-align", "center"); css.Add("font-size", "24px"); css.Add("font-family", "標楷體"); css.Add("border-style", "none"); css.Add("font-weight", "bold"); //cell.ColSpan = 11; row.Cells.Add(cell); table.Rows.Add(row); //-------------------------------------------- //轉成 html 碼 StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); table.RenderControl(htw); return htw.InnerWriter.ToString(); }
protected override void OnLoad(EventArgs e) { HtmlTable table = new HtmlTable(); Controls.Add(table); for (int r=0; r<500; r++) { HtmlTableRow row = new HtmlTableRow(); table.Rows.Add(row); HtmlTableCell firstCell = new HtmlTableCell(); firstCell.InnerText = r.ToString(); row.Cells.Add(firstCell); for(int c=0; c<9; c++) { HtmlTableCell cell = new HtmlTableCell(); cell.InnerText = "data"; row.Cells.Add(cell); } } }
protected void Page_Load(object sender, System.EventArgs e) { // Create a new HtmlTable object. HtmlTable table1 = new HtmlTable(); // Set the table's formatting-related properties. table1.Border = 1; table1.CellPadding = 3; table1.CellSpacing = 3; table1.BorderColor = "red"; // Start adding content to the table. HtmlTableRow row; HtmlTableCell cell; for (int i = 1; i <= 5; i++) { // Create a new row and set its background color. row = new HtmlTableRow(); row.BgColor = (i % 2 == 0 ? "lightyellow" : "lightcyan"); for (int j = 1; j <= 4; j++) { // Create a cell and set its text. cell = new HtmlTableCell(); cell.InnerHtml = "Row: " + i.ToString() + "<br>Cell: " + j.ToString(); // Add the cell to the current row. row.Cells.Add(cell); } // Add the row to the table. table1.Rows.Add(row); } // Add the table to the page. this.Controls.Add(table1); }
protected void Page_Init(object sender, EventArgs e) { string[] embeddedIcons = new string[] { "rbAdd", "rbRemove", "rbOk", "rbCancel", "rbUpload", "rbDownload", "rbPrevious", "rbNext", "rbOpen", "rbAttach", "rbSave", "rbConfig", "rbPrint", "rbRefresh", "rbSearch", "rbHelp", "rbCart", "rbEdit", "rbRSS", "rbMail", "rbFB", "rbTwitter", "rbLinkedIn", "rbPinterest", "rbYouTube", "rbVimeo", "rbBehance", "rbDribble", "rbGooglePlus"}; for (int i = 0; i < embeddedIcons.Length; i++) { string currIcon = embeddedIcons[i]; HtmlTableRow row1 = new HtmlTableRow(); //Add class name for icons: AddRowIconClassName(currIcon, table1, row1); //Add RadToggleButton with icons, Default skin: AddRadToggleButtonWithIcon("1" + i.ToString(), currIcon, "Silk", null, null, table1, row1); //Add RadToggleButton with icons, Glow skin: AddRadToggleButtonWithIcon("2" + i.ToString(), currIcon, "Glow", null, null, table1, row1); } }
private void LoadCategories() { const int countCells = 2; HtmlTableRow row = new HtmlTableRow(); Category c = new Category(); //c.Where.IsGallery.Value = true; if(c.Query.Load()) { do { string title = ""; if (!c.IsColumnNull("Title" + Utils.LangPrefix)) { title = c.GetColumn("Title" + Utils.LangPrefix).ToString(); } if (title.Trim() == "") { title = c.GetColumn("Name" + Utils.LangPrefix).ToString(); } if (row.Cells.Count < countCells) { row.Cells.Add(AddCategoryCellInnerHTML(c.CategoryID, title)); } else { tblCategory.Rows.Add(row); row = new HtmlTableRow(); row.Cells.Add(AddCategoryCellInnerHTML(c.CategoryID, title)); } } while (c.MoveNext()); } for (int i = row.Cells.Count; i < countCells; i++) { row.Cells.Add(AddTableCell(" ")); } tblCategory.Rows.Add(row); }
protected void Page_Load(object sender, EventArgs e) { HtmlTable table1 = new HtmlTable(); table1.Border = 1; table1.CellPadding = 3; table1.CellSpacing = 3; table1.BorderColor = "red"; HtmlTableRow row; HtmlTableCell cell; for (int i = 1; i <= 5; i++) { row = new HtmlTableRow(); row.BgColor=(i%2==0?"lightyellow":"lightcyan"); for (int j = 1; j <= 4; j++) { cell = new HtmlTableCell(); cell.InnerHtml = "Row: " + i.ToString() + "<br />Cell: " + j.ToString(); row.Cells.Add(cell); } table1.Rows.Add(row); } this.Controls.Add(table1); }
private void Page_Load(object sender, System.EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetAllowResponseInBrowserHistory(false); if (User.Identity.IsAuthenticated) { //this.SetCultura(); string sOpcion = "ObservacionTransito"; SisPacK.Menu oMenu = (SisPacK.Menu) this.FindControl("Menu1"); this.ValidarSeguridad(oMenu, sOpcion); } string entrar = Request["d"] != null ? Request["d"] : "0"; if (!Page.IsPostBack && entrar != "1") { Session["GuiasDefectuosas"] = null; this.txtGuiasDefectuosas.Text = "0"; CasoNormal(); this.txtGuiasDefectuosas.Text = "0"; } else { if (Session["GuiasDefectuosas"] == null) { CasoNormal(); this.txtGuiasDefectuosas.Text = "0"; } else // Hay guías para completar... { #region Caso Guias No Automatizadas this.txtGuiasDefectuosas.Text = "1"; Hashtable hGuias = (Hashtable)Session["GuiasDefectuosas"]; this.lblCantGuias.Text = "0"; this.txtGuiaIndex.Text = hGuias.Count.ToString(); HtmlTable table = new HtmlTable(); table.ID = "tGuiasRx"; // Mensaje HtmlTableRow trMensaje = new HtmlTableRow(); trMensaje.ID = "trMensaje"; HtmlTableCell tdMensaje = new HtmlTableCell(); tdMensaje.InnerHtml = "<i>Debe completar los datos de las siguientes guías:</i><br>"; tdMensaje.Attributes.Add("class", "TextoBold"); tdMensaje.Attributes.Add("colspan", "6"); trMensaje.Controls.Add(tdMensaje); table.Controls.Add(trMensaje); // Encabezado HtmlTableRow trEnc = new HtmlTableRow(); trEnc.ID = "trEnc"; HtmlTableCell tdEnc = new HtmlTableCell(); // Nro de Guía tdEnc.InnerHtml = "Nro. de Guía"; tdEnc.Attributes.Add("class", "TextoBold"); tdEnc.Attributes.Add("colSpan", "2"); tdEnc.Attributes.Add("align", "center"); trEnc.Controls.Add(tdEnc); // Observaciones tipificadas tdEnc = new HtmlTableCell(); tdEnc.InnerHtml = "Observación"; tdEnc.Attributes.Add("class", "TextoBold"); trEnc.Controls.Add(tdEnc); // Valor Declarado tdEnc = new HtmlTableCell(); tdEnc.InnerHtml = "Valor Declarado"; tdEnc.Attributes.Add("class", "TextoBold"); trEnc.Controls.Add(tdEnc); // Bultos tdEnc = new HtmlTableCell(); tdEnc.InnerHtml = "Bultos"; tdEnc.Attributes.Add("class", "TextoBold"); trEnc.Controls.Add(tdEnc); // Destino tdEnc = new HtmlTableCell(); tdEnc.InnerHtml = "Destino"; tdEnc.Attributes.Add("class", "TextoBold"); trEnc.Controls.Add(tdEnc); trEnc.Attributes.Add("style", "display: inline"); table.Controls.Add(trEnc); //for(int i=0; i<hGuias.Count; i++) int i = 0; foreach (string guia in hGuias.Keys) { // Creo un Tr HtmlTableRow tr = new HtmlTableRow(); // Creo un txt oculto, para guardar el número de guía TextBox txt = new TextBox(); txt.ID = "txt" + i.ToString(); txt.Text = guia; txt.Attributes.Add("style", "display : none"); HtmlTableCell tdTxt = new HtmlTableCell(); tdTxt.ID = "tdTxt" + i.ToString(); tdTxt.Controls.Add(txt); tr.Controls.Add(tdTxt); // Creo un td para el número de guía HtmlTableCell tdGuia = new HtmlTableCell(); tdGuia.InnerHtml = guia; tdGuia.Attributes.Add("class", "Texto"); tr.Controls.Add(tdGuia); // Creo un td para el control de observaciones tipificadas HtmlTableCell tdObs = new HtmlTableCell(); tdObs.ID = "td" + i.ToString(); // Creo un control de observaciones tipificadas Control obsUC = Page.LoadControl("UC/BusqObservacion.ascx"); obsUC.ID = "Obs" + i.ToString(); ((TextBox)obsUC.FindControl("txtTipoObservacionID")).Text = "1"; ((TextBox)obsUC.FindControl("txtSetearOrigen")).Text = "5"; string datos = hGuias[guia].ToString(); if (datos.Length > 2) // puede venir vacío, cuando entra porque hay guías incompletas { string[] datosObs = datos.Split('#'); ((TextBox)obsUC.FindControl("txtObservacionID")).Text = datosObs[0]; ((TextBox)obsUC.FindControl("txtCodigo")).Text = datosObs[1]; ((TextBox)obsUC.FindControl("txtObsDescrip")).Text = datosObs[2]; } tdObs.Controls.Add(obsUC); tr.Controls.Add(tdObs); tr.ID = "tr" + i.ToString(); tr.Attributes.Add("style", "display : inline"); table.Controls.Add(tr); i++; } phGuias.Controls.Add(table); #endregion } } Hashtable hGuiasNr = new Hashtable(); if (Session["GuiasNR"] != null) { hGuiasNr = (Hashtable)Session["GuiasNR"]; if (hGuiasNr.Count > 0) { MostrarGuiasNoRecepcionables(hGuiasNr); } } else { this.lblMensaje.Visible = false; } }
public NodeTypeAddPropertyTypeControl(cms.businesslogic.ContentType dt, ContentTypeControl parent) { ctctrl = parent; this.Attributes.Add("width", "100%"); HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell td = new HtmlTableCell(); td.InnerText = "Alias"; tr.Cells.Add(td); td = new HtmlTableCell(); td.InnerText = "Navn"; tr.Cells.Add(td); td = new HtmlTableCell(); td.InnerText = "Type"; tr.Cells.Add(td); td = new HtmlTableCell(); td.InnerText = "Fane"; tr.Cells.Add(td); td = new HtmlTableCell(); tr.Cells.Add(td); this.Rows.Add(tr); tr = new HtmlTableRow(); td = new HtmlTableCell(); td.Controls.Add(AliasTxt); tr.Cells.Add(td); td = new HtmlTableCell(); td.Controls.Add(NameTxt); tr.Cells.Add(td); td = new HtmlTableCell(); td.Controls.Add(DataTypeDDL); tr.Cells.Add(td); td = new HtmlTableCell(); td.Controls.Add(TabDDL); tr.Cells.Add(td); td = new HtmlTableCell(); Button btn = new Button(); td.Controls.Add(btn); btn.Text = "Opret"; tr.Cells.Add(td); this.Rows.Add(tr); // Add create new PropertyType eventhandler btn.Click += new System.EventHandler(this.AddPropertyType); foreach (cms.businesslogic.ContentType.TabI t in dt.getVirtualTabs.ToList()) { ListItem li = new ListItem(); li.Value = t.Id.ToString(); li.Text = t.Caption; TabDDL.Items.Add(li); } ListItem lie = new ListItem(); lie.Text = "Egenskaber"; lie.Value = "0"; TabDDL.Items.Add(lie); foreach (cms.businesslogic.datatype.DataTypeDefinition DataType in cms.businesslogic.datatype.DataTypeDefinition.GetAll()) { ListItem li = new ListItem(); li.Value = DataType.Id.ToString(); li.Text = DataType.Text; DataTypeDDL.Items.Add(li); } _dt = dt; }
private void ShowContentToPage(XmlElement root, HtmlTable oTable) { // 行准备 HtmlTableRow oRow = new HtmlTableRow(); oTable.Rows.Add(oRow); // 收缩预留 HtmlTableCell dCell = new HtmlTableCell(); oRow.Cells.Add(dCell); dCell.Align = "center"; if (root.ChildNodes.Count > 0) //一定是机构 { dCell.InnerHtml = "<strong onclick=\"showChildren()\">-</strong>"; } else { dCell.InnerHtml = " "; } // 图像预留 HtmlTableCell imgCell = new HtmlTableCell(); oRow.Cells.Add(imgCell); imgCell.Align = "center"; string strObjClass = root.GetAttribute("OBJECTCLASS"); imgCell.InnerHtml = "<IMG alt=\".\" src=\"../images/" + strObjClass.Substring(0, strObjClass.Length - 1) + ".gif\">"; // 填充所有数据 foreach (XmlNode oNode in _XmlParam.ChildNodes) { HtmlTableCell oCell = new HtmlTableCell(); oRow.Cells.Add(oCell); oCell.Align = "right"; string strValue = root.GetAttribute(oNode.SelectSingleNode("Value").InnerText); if (strValue == string.Empty) { strValue = " "; } oCell.InnerHtml = strValue; } // 统计数据 HtmlTableCell sCell = new HtmlTableCell(); oRow.Cells.Add(sCell); sCell.Align = "right"; if (root.ChildNodes.Count > 0) { string strStat = string.Empty; int iStat = root.SelectNodes("ORGANIZATIONS").Count; if (iStat > 0) { strStat += "直属机构<B>" + iStat.ToString() + "</B>个;"; } iStat = root.SelectNodes(".//ORGANIZATIONS").Count; if (iStat > 0) { strStat += "子孙机构<B>" + iStat.ToString() + "</B>个;"; } iStat = root.SelectNodes(".//GROUPS").Count; if (iStat > 0) { strStat += "人员组<B>" + iStat.ToString() + "</B>个;"; } iStat = root.SelectNodes(".//USERS").Count; if (iStat > 0) { strStat += "个人账号<B>" + iStat.ToString() + "</B>个;"; } sCell.InnerHtml = strStat; } else { sCell.InnerHtml = " "; } }
protected void DynamicalllAddList(int id) { pnlOrders.Controls.Clear(); con.Open(); SqlCommand cmd; SqlDataReader data; String query = "Select * from order_table WHERE Order_id = " + id + " ORDER BY Order_id DESC"; Session["Orderid"] = id.ToString(); using (cmd = new SqlCommand(query, con)) { data = cmd.ExecuteReader(); int count = 0; HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); while (data.Read()) { Label Username = new Label(); Username.Text = "Customer Username: "******"Username"].ToString(); Label Name = new Label(); Name.Text = "Product Name: " + data["Name"].ToString(); Label Price = new Label(); Price.Text = "Product Price: " + data["Price"].ToString(); Label Quantity = new Label(); Quantity.Text = "Product Quantity: " + data["Quantity"].ToString(); Label Date = new Label(); Date.Text = "Order Date: " + data["Date"].ToString() + " " + data["Time"].ToString(); Label Status = new Label(); Status.Text = "Product Status: " + data["Status"].ToString(); Panel pnlInfo = new Panel(); pnlInfo.CssClass = "infoPnl"; //pnlInfo.Controls.Add(new LiteralControl("====================== Order "+(count+1)+" ====================")); pnlInfo.Controls.Add(new LiteralControl("<br />")); pnlInfo.Controls.Add(Username); pnlInfo.Controls.Add(new LiteralControl("<br />")); pnlInfo.Controls.Add(Name); pnlInfo.Controls.Add(new LiteralControl("<br />")); pnlInfo.Controls.Add(Price); pnlInfo.Controls.Add(new LiteralControl("<br />")); pnlInfo.Controls.Add(Quantity); pnlInfo.Controls.Add(new LiteralControl("<br />")); pnlInfo.Controls.Add(Date); pnlInfo.Controls.Add(new LiteralControl("<br />")); pnlInfo.Controls.Add(Status); pnlOrders.Controls.Add(pnlInfo); count++; } if (count == 0) { Label lblFeedback = new Label(); lblFeedback.ForeColor = Color.Red; lblFeedback.Text = "No Records Found"; pnlOrders.Controls.Add(lblFeedback); } con.Close(); } }
/// <summary> /// /// </summary> /// <param name="dataView"></param> /// <param name="columnIndexes"></param> /// <param name="textWriter"></param> public static void Write( DataView dataView, int[] columnIndexes, TextWriter textWriter) { var htmlTable = new HtmlTable(); htmlTable.Border = 1; htmlTable.CellPadding = 1; htmlTable.CellSpacing = 0; //Font font = DataCommander.Providers.Application.Instance.MainForm.SelectedFont; //htmlTable.Style["font-family"] = font.FontFamily.Name; //htmlTable.Style["font-size"] = font.SizeInPoints.ToString(CultureInfo.InvariantCulture) + "pt"; htmlTable.Style["font-family"] = "Tahoma"; htmlTable.Style["font-size"] = "8pt"; var row = new HtmlTableRow(); var dataTable = dataView.Table; var columns = dataTable.Columns; for (var i = 0; i < columnIndexes.Length; i++) { var cell = new HtmlTableCell("TH"); var columnIndex = columnIndexes[i]; var column = columns[columnIndex]; var columnName = column.ColumnName; string html; if (columnName.Length > 0) { columnName = columnName.Trim(); } if (!string.IsNullOrEmpty(columnName)) { html = HttpUtility.HtmlEncode(column.ColumnName); } else { html = HtmlEntity.NonBreakingSpace; } html = "<nobr><handled>" + html + "</handled></nobr>"; cell.InnerHtml = html; row.Cells.Add(cell); } htmlTable.Rows.Add(row); var count = dataTable.Columns.Count; foreach (DataRowView dataRowView in dataView) { row = new HtmlTableRow(); for (var i = 0; i < columnIndexes.Length; i++) { var cell = new HtmlTableCell(); var columnIndex = columnIndexes[i]; var dataColumn = columns[columnIndex]; var type = (Type)dataColumn.ExtendedProperties[0]; if (type == null) { type = (Type)dataColumn.DataType; } var typeCode = Type.GetTypeCode(type); if (typeCode == TypeCode.Byte || typeCode == TypeCode.SByte || typeCode == TypeCode.Int16 || typeCode == TypeCode.Int32 || typeCode == TypeCode.Decimal || typeCode == TypeCode.Single || typeCode == TypeCode.Double) { cell.Align = "right"; } var value = dataRowView[i]; string valueStr; if (value == DBNull.Value) { valueStr = "(null)"; } else { valueStr = value.ToString().Trim(); if (valueStr.Length > 0) { if (valueStr.IndexOf('\r') >= 0 || valueStr.IndexOf('\n') >= 0) { var sb = new StringBuilder(); sb.Append("<pre>"); var s = HttpUtility.HtmlEncode(valueStr); sb.Append(s); sb.Append("</pre>"); valueStr = sb.ToString(); } else { valueStr = HttpUtility.HtmlEncode(valueStr); valueStr = "<nobr>" + valueStr + "</nobr>"; } } else { valueStr = HtmlEntity.NonBreakingSpace; } } cell.InnerHtml = valueStr; row.Cells.Add(cell); } htmlTable.Rows.Add(row); } var htmlTextWriter = new HtmlTextWriter(textWriter); htmlTable.RenderControl(htmlTextWriter); }
private void CasoNormal() { #region Caso Normal this.txtGuiasDefectuosas.Text = "0"; // Inicio con el botón "Confirmar" invisible this.butConfirmar.Attributes.Add("style", "display : none"); this.butCancelar.Attributes.Add("style", "display : none"); // Seteo la cantidad de guías máximas a recibir this.lblCantGuias.Text = cantGuias.ToString(); this.txtGuiaIndex.Attributes.Add("style", "display : none"); HtmlTable table = new HtmlTable(); table.ID = "tGuiasRx"; // Encabezado HtmlTableRow trEnc = new HtmlTableRow(); trEnc.ID = "trEnc"; HtmlTableCell tdEnc = new HtmlTableCell(); tdEnc.InnerHtml = "Nro. de Guía"; tdEnc.Attributes.Add("class", "TextoBold"); tdEnc.Attributes.Add("colSpan", "2"); tdEnc.Attributes.Add("align", "center"); trEnc.Controls.Add(tdEnc); tdEnc = new HtmlTableCell(); tdEnc.InnerHtml = "Observación"; tdEnc.Attributes.Add("class", "TextoBold"); trEnc.Controls.Add(tdEnc); tdEnc = new HtmlTableCell(); tdEnc.InnerHtml = " Observación Detallada"; tdEnc.Attributes.Add("class", "TextoBold"); trEnc.Controls.Add(tdEnc); trEnc.Attributes.Add("style", "display: none"); table.Controls.Add(trEnc); for (int i = 0; i < cantGuias; i++) { // Creo un Tr HtmlTableRow tr = new HtmlTableRow(); // Creo un txt oculto, para guardar el número de guía TextBox txt = new TextBox(); txt.ID = "txt" + i.ToString(); txt.Attributes.Add("style", "display : none"); HtmlTableCell tdTxt = new HtmlTableCell(); tdTxt.ID = "tdTxt" + i.ToString(); tdTxt.Controls.Add(txt); tr.Controls.Add(tdTxt); // Creo un td para el número de guía HtmlTableCell tdGuia = new HtmlTableCell(); tdGuia.ID = "td" + i.ToString(); tdGuia.Attributes.Add("class", "Texto"); tr.Controls.Add(tdGuia); // Creo un td para el control de observaciones tipificadas HtmlTableCell tdObs = new HtmlTableCell(); // Creo un control de observaciones tipificadas Control obsUC = Page.LoadControl("UC/BusqObservacion.ascx"); obsUC.ID = "Obs" + i.ToString(); ((TextBox)obsUC.FindControl("txtTipoObservacionID")).Text = "1"; ((TextBox)obsUC.FindControl("txtSetearOrigen")).Text = "0"; //5 tdObs.Controls.Add(obsUC); tr.Controls.Add(tdObs); HtmlTableCell txtObservDescrip = new HtmlTableCell(); txtObservDescrip.ID = "ObservacionP" + i.ToString(); TextBox txtODetallada = new TextBox(); txtODetallada.ID = "txtODetallada" + i.ToString(); txtObservDescrip.Controls.Add(txtODetallada); txtODetallada.Attributes.Add("class", "Campo"); tr.Controls.Add(txtObservDescrip); tr.ID = "tr" + i.ToString(); tr.Attributes.Add("style", "display : none"); table.Controls.Add(tr); } phGuias.Controls.Add(table); #endregion }
private void PrintTicket() { var layout = (List <BEPrintTicket>)Session["tckt"]; var olst = new List <BEPrintTicket>(); layout.GroupBy(dobj => new { dobj.CompanyName, dobj.Ruc, dobj.CompanyAddress, dobj.Phone, dobj.SerieMaqr, dobj.NumAtCard, dobj.DocDate, dobj.CardName, dobj.LicTradNum }) .ToList() .ForEach(obj => { var _obj = new BEPrintTicket() { CompanyName = obj.Key.CompanyName.ToUpper(), Ruc = obj.Key.Ruc.ToUpper(), CompanyAddress = obj.Key.CompanyAddress.ToUpper(), Phone = obj.Key.Phone.ToUpper(), SerieMaqr = obj.Key.SerieMaqr.ToUpper(), NumAtCard = "NRO. DOC: " + obj.Key.NumAtCard.ToUpper(), DocDate = "FECHA: " + obj.Key.DocDate, CardName = "CLIENTE: " + obj.Key.CardName.ToUpper(), LicTradNum = "RUC: " + obj.Key.LicTradNum }; olst.Add(_obj); }); string ans = JsonConvert.SerializeObject(olst, Formatting.Indented); string script = string.Format("var tkh = {{\"Head\": {0}}};", ans); script += "for(i = 0; i < tkh.Head.length; i++)"; script += "{"; script += "document.getElementById('CompanyName').innerHTML = tkh.Head[i].CompanyName;"; script += "document.getElementById('Ruc').innerHTML = tkh.Head[i].Ruc;"; script += "document.getElementById('CompanyAddress').innerHTML = tkh.Head[i].CompanyAddress;"; script += "document.getElementById('Phone').innerHTML = tkh.Head[i].Phone;"; script += "document.getElementById('SerieMaqr').innerHTML = tkh.Head[i].SerieMaqr;"; script += "document.getElementById('NumAtCard').innerHTML = tkh.Head[i].NumAtCard;"; script += "document.getElementById('DocDate').innerHTML = tkh.Head[i].DocDate;"; script += "document.getElementById('CardName').innerHTML = tkh.Head[i].CardName;"; script += "document.getElementById('LicTradNum').innerHTML = tkh.Head[i].LicTradNum;"; script += "}"; var cs = Page.ClientScript; cs.RegisterStartupScript(Page.GetType(), "JSON", script, true); var det = new HtmlTable() { ID = "det", Border = 0, CellPadding = 0, CellSpacing = 0, Width = "300px" }; var rwd = new HtmlTableRow(); var cld = new HtmlTableCell() { InnerHtml = string.Empty }; rwd.Cells.Add(cld); det.Rows.Add(rwd); layout.ForEach(obj => { var plg = ("S/." + obj.PriceDiscount).Length; rwd = new HtmlTableRow(); cld = new HtmlTableCell(); var val = string.Format("- {0} {1} {2}", obj.ItemCode, obj.Quantity, obj.ItemName); var ilg = 0; var ncad = ""; if (val.Length >= 36) { ilg = (34 - plg); ncad = val.Insert(ilg, (string.Format(" S/.{0}\n", obj.PriceDiscount))); } else { ilg = (36 - val.Length) - obj.PriceDiscount.ToString().Length; ncad = Replicate(val, " ", ilg, false) + string.Format(" S/.{0}", obj.PriceDiscount); } cld.InnerHtml = ncad; rwd.Cells.Add(cld); det.Rows.Add(rwd); }); Controls.Add(det); var foo = new HtmlTable() { ID = "foo", Border = 0, CellPadding = 0, CellSpacing = 0, Width = "300px" }; var rwfsp = new HtmlTableRow(); var clfsp = new HtmlTableCell() { InnerHtml = string.Empty, Height = "10px" }; rwfsp.Cells.Add(clfsp); det.Rows.Add(rwfsp); layout.GroupBy(dobj => new { dobj.SubTotal, dobj.VatSum, dobj.Discount, dobj.DocTotal }) .ToList() .ForEach(obj => { var val = Replicate(obj.Key.SubTotal.ToString(), " ", 24, true); val = Right(val, 24); var rwfs = new HtmlTableRow(); var clfs = new HtmlTableCell() { InnerHtml = "VALOR VENTA:" + val }; rwfs.Cells.Add(clfs); foo.Rows.Add(rwfs); if (!string.IsNullOrWhiteSpace(obj.Key.Discount.ToString()) && obj.Key.Discount.ToString() != "0") { val = Replicate("S/ " + obj.Key.Discount, " ", 26, true); val = Right(val, 26); var rwds = new HtmlTableRow(); var clds = new HtmlTableCell() { InnerHtml = "VALOR DSC:" + val }; rwds.Cells.Add(clds); foo.Rows.Add(rwds); } val = Replicate(obj.Key.VatSum.ToString(), " ", 26, true); val = Right(val, 26); var rwfv = new HtmlTableRow(); var clfv = new HtmlTableCell() { InnerHtml = "VALOR IGV:" + val }; rwfv.Cells.Add(clfv); foo.Rows.Add(rwfv); val = Replicate(obj.Key.DocTotal.ToString(), " ", 24, true); val = Right(val, 24); var rwfd = new HtmlTableRow(); var clfd = new HtmlTableCell() { InnerHtml = "TOTAL VENTA:" + val }; rwfd.Cells.Add(clfd); foo.Rows.Add(rwfd); }); rwfsp = new HtmlTableRow(); clfsp = new HtmlTableCell() { InnerHtml = string.Empty, Height = "10px" }; rwfsp.Cells.Add(clfsp); foo.Rows.Add(rwfsp); rwfsp = new HtmlTableRow(); clfsp = new HtmlTableCell() { InnerHtml = " GRACIAS POR SU COMPRA...!!", Align = "Center" }; rwfsp.Cells.Add(clfsp); foo.Rows.Add(rwfsp); Controls.Add(foo); }
public UserGridElements(HtmlTableRow masterRow) { this.masterRow = masterRow; }
public UserGridElements(string username) { this.masterRow = GetUserMasterRow(username); }
protected void rptMembershipTypes_OnItemDataBound(object sender, RepeaterItemEventArgs e) { msMembershipType mt = (msMembershipType)e.Item.DataItem; if (Page.IsPostBack) { return; // only do this if there's a postback - otherwise, preserve ViewState } switch (e.Item.ItemType) { case ListItemType.Header: break; case ListItemType.Footer: break; case ListItemType.AlternatingItem: goto case ListItemType.Item; case ListItemType.Item: var lRadioButtonMarkup = (Literal)e.Item.FindControl("lRadioButtonMarkup"); var lblMembershipType = (Label)e.Item.FindControl("lblMembershipType"); Label lblPrice = (Label)e.Item.FindControl("lblPrice"); Literal lMembershipDescription = (Literal)e.Item.FindControl("lMembershipDescription"); RadioButtonList rblSubCategory = (RadioButtonList)e.Item.FindControl("rblSubCategory"); HtmlTableRow trSubCategory = (HtmlTableRow)e.Item.FindControl("trSubCategory"); HiddenField hfMembershipType = (HiddenField)e.Item.FindControl("hfMembershipType"); lblMembershipType.Text = mt.Name; lMembershipDescription.Text = mt.Description; hfMembershipType.Value = mt.ID; // important, when we need to figure out the selected membership /* We have to use a literal for our radio button due to an ASP.NET bug with radiobuttons * in repeater controls * http://www.asp.net/learn/data-access/tutorial-51-cs.aspx-->*/ bool isSelected = mt.ID == selectedMembershipTypeID; // select if necessary string radioButtonID = "MembershipType" + e.Item.ItemIndex; lRadioButtonMarkup.Text = string.Format( @"<input type=radio name=MembershipType " + @"id={0} value='{1}' {2} onclick='showAppropriateSubCategory();' />", radioButtonID, mt.ID, isSelected ? "checked" : ""); if (allProducts == null) { return; } var relatedMembershipProducts = allProducts.FindAll(x => x.MembershipType == mt.ID); var relatedProducts = allDescribedProducts.Where(x => relatedMembershipProducts.Exists(y => y.ProductID == x.ProductID)).ToList(); switch (relatedProducts.Count) { case 0: return; // should never happen, we filtered before this case 1: var singleProduct = relatedProducts[0]; lblPrice.Text = singleProduct.DisplayPriceAs ?? singleProduct.Price.ToString("C"); // let's still add it, b/c we need to reference this on the save rblSubCategory.Items.Add(new ListItem( string.Format("{0} - <span style='color: green'>{1}</span>", singleProduct.ProductName, singleProduct.DisplayPriceAs ?? singleProduct.Price.ToString("C")), singleProduct.ProductID)); trSubCategory.Visible = false; break; default: List <string> prices = (from p in allProducts join dp in allDescribedProducts on p.ProductID equals dp.ProductID where p.MembershipType == mt.ID select string.IsNullOrWhiteSpace(dp.DisplayPriceAs) ? dp.Price.ToString("C") : dp.DisplayPriceAs ).ToList(); //MS-2090 //If there is at least one string that starts with a price (like "$10", "15.99" or "$30/month") //then use our custom price sorting algorithm //Otherwise just sort alphabetically IComparer <string> sorter = StringComparer.CurrentCultureIgnoreCase; if (prices.Exists(PriceComparer.StartsWithPrice)) { sorter = new PriceComparer(); } prices.Sort(sorter); if (prices.Count > 0) { lblPrice.Text = string.Format("{0}-{1}", prices.First(), prices.Last()); } trSubCategory.Visible = true; foreach (var p in relatedProducts) { ListItem listItem = new ListItem( string.Format("{0} - <span style='color: green'>{1}</span>", p.ProductName, p.DisplayPriceAs ?? p.Price.ToString("C")), p.ProductID); if (p.ProductID == selectedMembershipFeeID) { listItem.Selected = true; } rblSubCategory.Items.Add(listItem); } rblSubCategory.SelectedIndex = 0; // make sure the first item is selected if (!isSelected) { trSubCategory.Attributes["style"] = "display: none;"; // hide it by default } // we also need to add javascript such that when this subcategory only appears // when the parent radio button is selected // so, since this is visible, we'll track it RadioButtonSubCategoryPairs.Add(new NameValueStringPair(radioButtonID, trSubCategory.ClientID)); break; } break; } }
protected void OrderItemsRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { switch (e.Item.ItemType) { case (ListItemType.Item): case (ListItemType.AlternatingItem): // Get the order item and its corresponding asset OrderItem orderItem = (OrderItem)e.Item.DataItem; Asset asset = orderItem.Asset; // Get all controls we'll be using HiddenField OrderItemIdHiddenField = (HiddenField)e.Item.FindControl("OrderItemIdHiddenField"); HiddenField AssetIdHiddenField = (HiddenField)e.Item.FindControl("AssetIdHiddenField"); AssetThumbnail AssetThumbnail1 = (AssetThumbnail)e.Item.FindControl("AssetThumbnail1"); AssetButtons AssetButtons1 = (AssetButtons)e.Item.FindControl("AssetButtons1"); FileSizeMessageLabel FileSizeLabel = (FileSizeMessageLabel)e.Item.FindControl("FileSizeLabel"); EmailHyperLink AssetContactHyperlink = (EmailHyperLink)e.Item.FindControl("AssetContactHyperlink"); HyperLink DownloadHyperlink = (HyperLink)e.Item.FindControl("DownloadHyperlink"); CheckBox SelectAssetCheckBox = (CheckBox)e.Item.FindControl("SelectAssetCheckBox"); DownloadFormatDropDownList DownloadFormatDropDownList1 = (DownloadFormatDropDownList)e.Item.FindControl("DownloadFormatDropDownList1"); AssetImageSizeDropDownList AssetImageSizeDropDownList1 = (AssetImageSizeDropDownList)e.Item.FindControl("AssetImageSizeDropDownList1"); FeedbackLabel OrderItemMessageLabel = (FeedbackLabel)e.Item.FindControl("OrderItemMessageLabel"); PlaceHolder ImageOptionsPlaceHolder = (PlaceHolder)e.Item.FindControl("ImageOptionsPlaceHolder"); HtmlTableRow FileSizeRow = (HtmlTableRow)e.Item.FindControl("FileSizeRow"); HtmlGenericControl SelectorContainer = (HtmlGenericControl)e.Item.FindControl("SelectorContainer"); HtmlGenericControl LinkButtonWrapper = (HtmlGenericControl)e.Item.FindControl("LinkButtonWrapper"); FileSizeMessageLabel ImageFileSizeMessageLabel = (FileSizeMessageLabel)e.Item.FindControl("ImageFileSizeMessageLabel"); // Populate table cells with basic information about the asset SetTableCellText(e.Item, "AssetReferenceCell", asset.AssetId.ToString()); SetTableCellHtml(e.Item, "DescriptionCell", SiteUtils.ConvertTextToHtml(asset.Description)); SetTableCellText(e.Item, "BrandCell", asset.Brand.Name); SetTableCellText(e.Item, "AssetTypeCell", asset.AssetType.Name); SetTableCellHtml(e.Item, "UsageRestrictionsCell", asset.UsageRestrictions); SetTableCellText(e.Item, "DateRequestedByCell", orderItem.RequiredByDate.HasValue ? orderItem.RequiredByDate.Value.ToString(Global.DateFormat) : "None"); SetTableCellText(e.Item, "DateOfDecisionCell", orderItem.OrderItemStatusDate.HasValue ? orderItem.OrderItemStatusDate.Value.ToString(Global.DateFormat) : "None"); SetTableCellText(e.Item, "NotesCell", orderItem.Notes); // Populate hidden fields as we'll need these for other stuff OrderItemIdHiddenField.Value = orderItem.OrderItemId.ToString(); AssetIdHiddenField.Value = asset.AssetId.ToString(); // Get/Initialise other objects we'll need here AssetStatus assetStatus = AssetManager.GetAssetStatusForUser(asset, CurrentUser); SelectedOrderItem soi = SelectedOrderItems.Get(orderItem.OrderItemId.GetValueOrDefault()); // Check if user can download this asset bool canDownload = CanDownload(orderItem); // Initialise the thumbnail and buttons AssetThumbnail1.Initialise(asset); AssetButtons1.Initialise(asset); // Populate other controls which are not dependent on the asset type AssetContactHyperlink.SetNameEmail(asset.UploadedByUser.FullName, asset.UploadedByUser.Email); SelectorContainer.Visible = canDownload; SelectAssetCheckBox.Checked = IsOrderItemSelected(orderItem.OrderItemId.GetValueOrDefault()); DownloadHyperlink.NavigateUrl = string.Format("javascript:downloadAsset('{0}','{1}','{2}', '{3}', '{4}')", orderItem.AssetId, orderItem.OrderId, orderItem.OrderItemId, DownloadFormatDropDownList1.ClientID, AssetImageSizeDropDownList1.ClientID); // Do processing dependent on asset type if (AssetTypeChecker.IsImage(asset.FileExtension)) { // Only show download resolution row if user can download ImageOptionsPlaceHolder.Visible = canDownload; // Only do the image size stuff if the download resolution row is visible if (ImageOptionsPlaceHolder.Visible) { // Populate the download format dropdown with the previously selected value (if any) DownloadFormatDropDownList1.SafeSelectValue(soi.DownloadFormat); // Populate the asset image size dropdown with the previously selected value (if any) AssetImageSizeDropDownList1.SafeSelectValue(soi.AssetImageSizeId); // Get the filename to the image *if it exists already* string filename = AssetImageManager.GetResizedAssetImage(asset, AssetImageSizeDropDownList1.SelectedId, DownloadFormatDropDownList1.SelectedDownloadFormat, false); // Only set the filesize if the scaled image already exists, as it will be too heavy to create a scaled image // of each asset as the page loads. Maybe we should do this when assets are uploaded... if (filename != string.Empty) { ImageFileSizeMessageLabel.SetFileSize(FileUtils.GetFileSize(filename)); } } } // Only show file size row if download resolution row is hidden and user can download this asset // (No point showing them the filesize for an asset they can't download) if (ImageOptionsPlaceHolder.Visible) { FileSizeRow.Visible = false; } else { FileSizeRow.Visible = canDownload; FileSizeLabel.SetFileSize(asset.FileSize); } // Only show the conversation row if we have a conversation HtmlTableRow ConversationRow = (HtmlTableRow)e.Item.FindControl("ConversationRow"); ConversationRow.Visible = (orderItem.OrderItemCommentList.Count > 0); // Bind conversation Repeater ConversationRepeater = (Repeater)e.Item.FindControl("ConversationRepeater"); ConversationRepeater.DataSource = orderItem.OrderItemCommentList; ConversationRepeater.DataBind(); // Hide the row to add notes, as this is only visible whilst an order item is awaiting approval HtmlTableRow AddNotesRow = (HtmlTableRow)e.Item.FindControl("AddNotesRow"); AddNotesRow.Visible = false; if (assetStatus == AssetStatus.Available) { switch (orderItem.OrderItemStatus) { case (OrderItemStatus.Preapproved): OrderItemMessageLabel.SetSuccessMessage("no approval required", "Approval is not required to download and use this asset."); LinkButtonWrapper.Visible = false; break; case (OrderItemStatus.Approved): OrderItemMessageLabel.SetSuccessMessage("approved", "Approval to use this asset has been granted. Refer to the response given in the approval details for any further information."); LinkButtonWrapper.Visible = true; break; case (OrderItemStatus.AwaitingApproval): OrderItemMessageLabel.MessageType = BaseMessageLabel.MessageTypes.Pending; OrderItemMessageLabel.Header = "approval pending"; OrderItemMessageLabel.Text = "Approval to use this asset is pending a decision. An email will be sent to you when a decision is made."; LinkButtonWrapper.Visible = true; AddNotesRow.Visible = true; break; case (OrderItemStatus.Rejected): OrderItemMessageLabel.SetErrorMessage("approval rejected", "Approval to use this asset has been rejected. Refer to the response given in the approval notes for further information."); LinkButtonWrapper.Visible = true; break; } } else { OrderItemMessageLabel.MessageType = BaseMessageLabel.MessageTypes.Withdrawn; OrderItemMessageLabel.Header = "asset withdrawn"; OrderItemMessageLabel.Text = "This asset has been withdrawn from the system and is no longer available to download."; LinkButtonWrapper.Visible = false; } if (WebUtils.GetIntRequestParam("OrderItemId", 0) == orderItem.OrderItemId) { Panel ApprovalDetailsPanel = (Panel)e.Item.FindControl("ApprovalDetailsPanel"); ApprovalDetailsPanel.Visible = true; LinkButton ToggleApprovalDetailsLinkButton = (LinkButton)e.Item.FindControl("ToggleApprovalDetailsLinkButton"); ToggleApprovalDetailsLinkButton.Text = "hide approval details [-]"; } break; } }
private void BindData() { bool flag = false; inputReceiptReportCollectin reportInfo = inputReceiptAction.GetReportInfo(this.PlanNo, out this.PlanYear); this.lbPlanYear.Text = this.PlanYear; foreach (inputReceiptReportInfo inputReceiptReportInfo in reportInfo) { if (!inputReceiptReportInfo.IsProject) { this.CreateDpm(inputReceiptReportInfo, false); } else { if (!flag) { flag = true; this.CreateDpm(new inputReceiptReportInfo { PrjName = "项目经理部", InputAmount = reportInfo.GetPrjInputAmount(), InputCompAmount = reportInfo.GetPrjInputCompAmount(), ReceiptAmount = reportInfo.GetPrjReceiptAmount(), ReceiptCompAmount = reportInfo.GetPrjReceiptCompAmount() }, true); this.CreateAllPrjRows(reportInfo); } } } HtmlTableRow htmlTableRow = new HtmlTableRow(); this.iIndex++; HtmlTableCell htmlTableCell = new HtmlTableCell(); htmlTableCell.ColSpan = 3; htmlTableCell.InnerText = "合计:" + reportInfo.GetAllReceiptAmount().ToString(); htmlTableRow.Style.Add("FONT-WEIGHT", "bold"); htmlTableRow.Cells.Add(htmlTableCell); HtmlTableCell htmlTableCell2 = new HtmlTableCell(); htmlTableCell2.InnerText = reportInfo.GetAllReceiptCompAmount().ToString(); htmlTableRow.Cells.Add(htmlTableCell2); HtmlTableCell htmlTableCell3 = new HtmlTableCell(); if (reportInfo.GetAllReceiptAmount() != 0m) { htmlTableCell3.InnerText = Convert.ToString(decimal.Round(reportInfo.GetAllReceiptCompAmount() / reportInfo.GetAllReceiptAmount() * 100m, 2)); } else { htmlTableCell3.InnerText = "0"; } htmlTableRow.Cells.Add(htmlTableCell3); HtmlTableCell htmlTableCell4 = new HtmlTableCell(); htmlTableCell4.InnerText = reportInfo.GetAllInputAmount().ToString(); htmlTableRow.Cells.Add(htmlTableCell4); HtmlTableCell htmlTableCell5 = new HtmlTableCell(); htmlTableCell5.InnerText = reportInfo.GetAllInputCompAmount().ToString(); htmlTableRow.Cells.Add(htmlTableCell5); HtmlTableCell htmlTableCell6 = new HtmlTableCell(); if (reportInfo.GetAllInputAmount() != 0m) { htmlTableCell6.InnerText = Convert.ToString(decimal.Round(reportInfo.GetAllInputCompAmount() / reportInfo.GetAllInputAmount() * 100m, 2)); } else { htmlTableCell6.InnerText = "0"; } htmlTableRow.Cells.Add(htmlTableCell6); htmlTableRow.Height = "22"; this.tbReport.Rows.Add(htmlTableRow); }
private void WriteReportBlock(DataTable table, string idColumns, string linkColumn) { string sortOrder = idColumns; if (linkColumn != null) { sortOrder += ", " + linkColumn; } DataRow[] row = table.Select("Active = 0", sortOrder); HtmlTableRow tr = new HtmlTableRow(); tblReport.Rows.Add(tr); tr.Attributes["class"] = row.Length == 0 ? "ReportHeader Closed" : "ReportHeader Opened"; HtmlTableCell td = new HtmlTableCell(); tr.Cells.Add(td); td.ColSpan = 3; td.InnerText = AppSettings.ConfigurationTablePrefix + table.TableName; td = new HtmlTableCell(); tr.Cells.Add(td); td.ColSpan = 2; if (row.Length > 0) { td.InnerText = String.Format("{0} deactivated", row.Length); } for (int i = 0; i < row.Length; ++i) { tr = new HtmlTableRow(); tblReport.Rows.Add(tr); tr.Attributes["class"] = "ReportRow"; td = new HtmlTableCell(); tr.Cells.Add(td); td.Align = "right"; td.VAlign = "top"; td.InnerText = (i + 1).ToString(); td = new HtmlTableCell(); tr.Cells.Add(td); td.VAlign = "top"; string[] idColumn = idColumns.Split(','); td.InnerText = row[i][idColumn[0]].ToString(); for (int j = 1; j < idColumn.Length; ++j) { td.InnerText += ", " + row[i][idColumn[j]].ToString(); } td = new HtmlTableCell(); tr.Cells.Add(td); td.VAlign = "top"; if (linkColumn != null) { td.InnerText = row[i][linkColumn].ToString(); } td = new HtmlTableCell(); tr.Cells.Add(td); td.ColSpan = 2; } tr = new HtmlTableRow(); tblReport.Rows.Add(tr); tr.Attributes["class"] = "ReportSpacer"; td = new HtmlTableCell(); tr.Cells.Add(td); td.ColSpan = ColumnCount; td.Height = "6px"; }
/// <summary> /// ItemDataBound /// </summary> protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { string img, alt, publishedTask; HtmlTableRow tr = (HtmlTableRow)e.Item.FindControl("trList"); HtmlInputText txt = null; if (e.Item.ItemIndex % 2 == 0) { tr.Attributes.Add("class", "even"); } else { tr.Attributes.Add("class", "old"); } try { PNK_ProductCategory data = (PNK_ProductCategory)e.Item.DataItem; //Role Literal ltr = null; ltr = (Literal)e.Item.FindControl("ltrchk"); ltr.Text = string.Format(@"<INPUT class='txt' TYPE='checkbox' ID='cb{0}' NAME='cid[]' value='{1}' onclick='isChecked(this.checked);' >", e.Item.ItemIndex, data.Id); //Check if (data.Published == "1") { img = "tick.png"; alt = LocalizationUtility.GetText(ltrAdminPublish.Text); publishedTask = "unpublish"; } else { img = "publish_x.png"; alt = LocalizationUtility.GetText(ltrAminUnPublish.Text); publishedTask = "publish"; } //Order txt = (HtmlInputText)e.Item.FindControl("txtOrder"); txt.Value = DBConvert.ParseString(data.Ordering); //Id HtmlInputButton btId = (HtmlInputButton)e.Item.FindControl("btId"); btId.Value = DBConvert.ParseString(data.Id); //Base img HtmlImage baseImage = (HtmlImage)e.Item.FindControl("baseImage"); baseImage.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductCategoryUpload"], data.BaseImage); HtmlAnchor hypBaseImage = (HtmlAnchor)e.Item.FindControl("hypBaseImage"); //set link HyperLink hdflink = new HyperLink(); hdflink = (HyperLink)e.Item.FindControl("hdflink"); hypBaseImage.HRef = hdflink.NavigateUrl = template_path + LinkHelper.GetAdminLink("edit_productcategory", data.Id); //HtmlTableCell td = (HtmlTableCell)e.Item.FindControl("tdName"); //td.Attributes.Add("onclick", string.Format("listItemTask('cb{0}', 'Edit')", e.Item.ItemIndex)); //td = (HtmlTableCell)e.Item.FindControl("trUpdateDate"); //td.Attributes.Add("onclick", string.Format("listItemTask('cb{0}', 'Edit')", e.Item.ItemIndex)); ImageButton imgctr = (ImageButton)e.Item.FindControl("btnPublish"); imgctr.ImageUrl = string.Format("/Admin/images/{0}", img); imgctr.Attributes.Add("alt", alt); HtmlTableCell btn = (HtmlTableCell)e.Item.FindControl("tdbtn"); btn.Attributes.Add("onclick", string.Format(" return listItemTask('cb{0}', '{1}')", e.Item.ItemIndex, publishedTask)); //Name ltr = (Literal)e.Item.FindControl("ltrName"); hypBaseImage.Attributes["title"] = baseImage.Alt = baseImage.Attributes["title"] = ltr.Text = data.ProductCategoryDesc.TreeNameDesc; // Utils.GetScmplitBySpace(data.ProductCategoryDesc.Name, data.PathTree); //Server.HtmlDecode(getScmplit(data.Lvl) + "• | " + data.Lvl + " | " + data.ProductCategoryDesc.Name); } catch { } } }
/// <summary> /// 列表视图控件生成 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { FileSystemInfo file = e.Item.DataItem as FileSystemInfo; String filepath = "/" + RootPath.MakeRelativeUri(new Uri(file.FullName)).ToString(); HtmlTableRow row = (HtmlTableRow)e.Item.FindControl("row"); ImageButton del = (ImageButton)e.Item.FindControl("del"); ImageButton edit = (ImageButton)e.Item.FindControl("edit"); ImageButton save = (ImageButton)e.Item.FindControl("save"); del.OnClientClick = String.Format("javascript:dialogConfirm({{el:this,text:'将删除 {0} 且无法恢复!确定要删除吗?'}});return false;", file.Name); edit.OnClientClick = String.Format("javascript:dialogIFrame({{ url: 'SiteFile.aspx?action=rename&file={1}', title: '重命名 - {0}', width: 350, height: 250 }});return false;", file.Name, Server.UrlEncode(filepath)); HtmlTableCell td1 = (HtmlTableCell)row.Controls[1]; Image ico = new Image(); ico.Attributes.Add("align", "absmiddle"); ico.Attributes.Add("style", "padding-right:5px;"); td1.Controls.Add(ico); HyperLink link = new HyperLink(); link.Text = file.Name; link.ToolTip = file.Name; td1.Controls.Add(link); if (file.Attributes == FileAttributes.Directory) { link.NavigateUrl = "SiteFile.aspx?dir=" + filepath; ico.ImageUrl = "../skin/files/folder_small.png"; } else { save.Visible = true; FileInfo _file = file as FileInfo; String ex = String.IsNullOrEmpty(_file.Extension) ? "none" : _file.Extension.Trim('.'); HtmlTableCell td4 = row.Controls[4] as HtmlTableCell; long size = _file.Length; td4.InnerText = FileHelper.FileSizeToStr((long)(size)); String src = String.Format("../skin/files/{0}_small.png", ex); if (!icons.Contains(ex)) { src = "../skin/files/none.png"; } ico.ImageUrl = src; switch (ex) { case "gif": case "jpeg": case "png": case "bmp": case "jpg": link.NavigateUrl = filepath; link.Attributes.Add("rel", "group1"); link.Attributes.Add("class", "lightbox"); Image exlink = new Image(); exlink.ImageAlign = ImageAlign.Baseline; exlink.ToolTip = "查看大图"; exlink.Style.Add("margin-left", "5px"); exlink.Attributes.Add("align", "absmiddle"); exlink.ImageUrl = "../skin/icos/Link.png"; td1.Controls.Add(exlink); break; case "aspx": case "asax": case "ascx": case "cs": case "ashx": case "config": case "js": case "css": case "txt": case "htm": case "html": case "xml": case "asp": case "shtml": case "ini": case "as": case "md": case "json": case "yml": link.NavigateUrl = "javascript:"; link.Attributes.Add("onclick", String.Format("javascript:dialogIFrame({{ url: 'SiteFile.aspx?action=edit&file={1}', title: '编辑 - {0}', width: 700, height: 500}});return false;", file.Name, Server.UrlEncode(filepath))); break; case "rar": case "pdf": case "ppt": case "pptx": case "doc": case "docx": case "mdb": case "accdb": case "xlsx": case "xls": case "psd": case "wma": case "chm": break; } } } }
protected void cargaUsuarios() { string Sp = "SP_SEL_USUARIOS @ACTIVO = 1"; using (DataTable dr = Conexion.GetDataTable(Sp)) { foreach (DataRow row in dr.Rows) { HtmlTableRow rowNew = new HtmlTableRow(); tblUsuarios.Controls.Add(rowNew); HtmlTableCell cell_rut = new HtmlTableCell("td"); HtmlTableCell cell_nombre = new HtmlTableCell("td"); HtmlTableCell cell_cargo = new HtmlTableCell("td"); HtmlTableCell cell_area = new HtmlTableCell("td"); HtmlTableCell cell_perfil = new HtmlTableCell("td"); HtmlTableCell cell_email = new HtmlTableCell("td"); HtmlTableCell cell_estado = new HtmlTableCell("td"); HtmlTableCell cell_accion = new HtmlTableCell("td"); Label lblRut = new Label(); Label lblNombre = new Label(); Label lblcargo = new Label(); Label lblArea = new Label(); Label lblPerfil = new Label(); Label lblEmail = new Label(); Label lblEstado = new Label(); Label lblAccion = new Label(); lblRut.Text = row["rut_usuario"].ToString(); lblNombre.Text = row["nombre_usuario"].ToString(); lblcargo.Text = row["cargo"].ToString(); lblArea.Text = row["nombre_area"].ToString(); lblPerfil.Text = row["nombre_perfil"].ToString(); lblEmail.Text = row["email"].ToString(); lblAccion.Text = "<a href='EditarUsuario.aspx?rut=" + rutUsuario + "&usuario=" + row["rut_usuario"].ToString() + "' class='btn btn-info btn-xs'><span class='glyphicon glyphicon-floppy-disk' aria-hidden='true'></span> Editar</a>"; string Estado = row["activo"].ToString(); switch (Estado) { case "1": lblEstado.Text = "<button type='button' class='btn btn-success btn-xs'><span class='glyphicon glyphicon-floppy-disk' aria-hidden='true'></span> Activo</button>"; break; case "0": lblEstado.Text = "<button type='button' class='btn btn-warning btn-xs'><span class='glyphicon glyphicon-floppy-disk' aria-hidden='true'></span> Inactivo</button>"; break; } cell_rut.Controls.Add(lblRut); cell_nombre.Controls.Add(lblNombre); cell_cargo.Controls.Add(lblcargo); cell_area.Controls.Add(lblArea); cell_perfil.Controls.Add(lblPerfil); cell_email.Controls.Add(lblEmail); cell_estado.Controls.Add(lblEstado); cell_accion.Controls.Add(lblAccion); cell_rut.Attributes.Add("class", "text-left"); cell_nombre.Attributes.Add("class", "text-left"); cell_cargo.Attributes.Add("class", "text-left"); cell_area.Attributes.Add("class", "text-left"); cell_perfil.Attributes.Add("class", "text-left"); cell_email.Attributes.Add("class", "text-left"); rowNew.Controls.Add(cell_rut); rowNew.Controls.Add(cell_nombre); rowNew.Controls.Add(cell_cargo); rowNew.Controls.Add(cell_area); rowNew.Controls.Add(cell_perfil); rowNew.Controls.Add(cell_email); rowNew.Controls.Add(cell_estado); rowNew.Controls.Add(cell_accion); } } }
public void BindData(string stryhid, string begintime, string endtime) { int j = 0; SqlConnection cnn = default(SqlConnection); SqlCommand cmd = default(SqlCommand); SqlDataReader dr = default(SqlDataReader); cnn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["haokeDataLink"]); //得到年历数据 cmd = new SqlCommand("SELECT * FROM OA_KQ_WorkDate WHERE YHID='" + stryhid + "' AND RQ BETWEEN '" + begintime + "' AND '" + endtime + "' ORDER BY RQ", cnn); cnn.Open(); dr = cmd.ExecuteReader(); bool outwhile = false; while (!outwhile) { HtmlTableRow row = new HtmlTableRow(); row.Height = "30"; //设置行高 while (row.Cells.Count < 7) { //如果列数小于7则继续(7列为一行) if (!dr.Read()) { //如果取到了数据 //填补空余列 int blankcells = 7 - row.Cells.Count; int i = 0; for (i = 0; i <= blankcells - 1; i++) { HtmlTableCell tmpcell = new HtmlTableCell(); tmpcell.InnerHtml = " "; row.Cells.Add(tmpcell); } daytable.Rows.Add(row); outwhile = true; break; // TODO: might not be correct. Was : Exit While } HtmlTableCell col = new HtmlTableCell(); switch (DateTime.Parse(dr[2].ToString()).DayOfWeek.ToString()) { case "Monday": j = 1; break; case "Tuesday": j = 2; break; case "Wednesday": j = 3; break; case "Thursday": j = 4; break; case "Friday": j = 5; break; case "Saturday": j = 6; break; case "Sunday": j = 7; break; default: break; } col.ID = dr["wdID"].ToString(); col.Align = "center"; if (dr["ynSB"].ToString() == "Y") { //根据该日是否需要上班,设置单元格背景色 col.Style.Add("background-color", indaycolor); } else { col.Style.Add("background-color", outdaycolor); } col.InnerText = DateTime.Parse(dr["rq"].ToString()).Month.ToString() + "-" + DateTime.Parse(dr["rq"].ToString()).Day.ToString(); //如果当前日期紧接前面的日期就添加列 if (row.Cells.Count + 1 == j) { col.Style.Add("cursor", "hand"); row.Cells.Add(col); col.Attributes["onclick"] = "Click_Cell(this);"; } else { int blankcell = j - row.Cells.Count - 1; //补充缺掉的cell if (blankcell > 0) { int k = 0; for (k = 0; k <= blankcell - 1; k++) { HtmlTableCell tmpcol = new HtmlTableCell(); //tmpcol.BgColor = outdaycolor; tmpcol.InnerText = ""; row.Cells.Add(tmpcol); } col.Style.Add("cursor", "hand"); row.Cells.Add(col); col.Attributes["onclick"] = "Click_Cell(this);"; } else { blankcell = j + 6 - row.Cells.Count; int k = 0; for (k = 0; k <= blankcell - 1; k++) { if (row.Cells.Count == 7) { daytable.Rows.Add(row); } else { HtmlTableCell tmpcol = new HtmlTableCell(); //tmpcol.BgColor = outdaycolor; tmpcol.InnerText = ""; row.Cells.Add(tmpcol); } col.Style.Add("cursor", "hand"); row.Cells.Add(col); col.Attributes["onclick"] = "if(this.style.backgroundColor=='" + indaycolor + "') this.style.backgroundColor = '" + outdaycolor + "';else this.style.backgroundColor = '" + indaycolor + "';Click_Cell(this);this.blur();"; } } } //添加完列判断是否需要添加行 if (row.Cells.Count == 7) { daytable.Rows.Add(row); } } } dr.Close(); cnn.Close(); }
protected void tambahbaris(short i) { HtmlTableRow tr; HtmlTableCell c; TextBox tb; TextBox tb2; TextBox tb4; TextBox tb5; TextBox tb6; TextBox tb7; TextBox tb8; HtmlInputButton btn; Label l; tr = new HtmlTableRow(); tr.VAlign = "top"; list.Controls.Add(tr); c = new HtmlTableCell(); c.InnerHtml = i.ToString() + "."; tr.Cells.Add(c); tb = new TextBox(); tb.ID = "kodebr_" + i; tb.Width = 120; tb8 = new TextBox(); tb8.ID = "kodebr2_" + i; tb8.Attributes["style"] = "display:none"; btn = new HtmlInputButton(); btn.ID = "btnacc_" + i; btn.Value = "..."; btn.Attributes["class"] = "search"; tb2 = new TextBox(); tb2.ID = "namabr_" + i; tb2.Width = 200; tb2.ReadOnly = true; tb4 = new TextBox(); tb4.ID = "satuanbr_" + i; tb4.Width = 70; tb4.ReadOnly = true; tb5 = new TextBox(); tb5.ID = "hrgabr_" + i; Js.NumberFormat(tb5); tb5.Width = 140; tb5.ReadOnly = true; tb6 = new TextBox(); tb6.ID = "qtybr_" + i; tb6.Text = "0"; tb6.Attributes["onfocus"] = "tempnum=CalcFocus(this);"; tb6.Attributes["onkeyup"] = "CalcType(this,tempnum);"; tb6.Attributes["onblur"] = "CalcBlur(this);hitungaja('" + i + "');"; tb6.Width = 50; tb7 = new TextBox(); tb7.ID = "totalbr_" + i; tb7.Width = 140; tb7.ReadOnly = true; string Project = Db.SingleString("SELECT Project FROM MS_KONTRAK WHERE NoKontrak = '" + NoKontrak + "'"); tb.Attributes["ondblclick"] = btn.Attributes["onclick"] = "callgimmick('" + tb.ID + "','" + tb2.ID + "','" + tb4.ID + "','" + tb5.ID + "','" + tb8.ID + "','" + Project + "')"; c = new HtmlTableCell(); c.Controls.Add(tb); c.Controls.Add(tb8); c.Controls.Add(btn); tr.Cells.Add(c); c = new HtmlTableCell(); c.Controls.Add(tb2); tr.Cells.Add(c); c = new HtmlTableCell(); c.Controls.Add(tb4); tr.Cells.Add(c); c = new HtmlTableCell(); c.Controls.Add(tb5); tr.Cells.Add(c); c = new HtmlTableCell(); c.Controls.Add(tb6); tr.Cells.Add(c); c = new HtmlTableCell(); c.Controls.Add(tb7); tr.Cells.Add(c); c = new HtmlTableCell(); l = new Label(); l.Text = "<i class='fa fa-trash'></i>"; l.CssClass = "btn btn-cal"; StringBuilder x = new StringBuilder(); x.Append("ClearGimmick('kodebr_" + i + "','kodebr2_" + i + "','namabr_" + i + "','satuanbr_" + i + "','hrgabr_" + i + "','qtybr_" + i + "','totalbr_" + i + "');"); l.Attributes["onclick"] = x.ToString(); c.Controls.Add(l); tr.Cells.Add(c); }
protected void Page_Load(object sender, EventArgs e) { TableRow trow = new TableRow(); var td = new TableCell(); var lt = new Literal(); SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; String sqlStmt = "SELECT * FROM dbo.Alarms WHERE UserID = " + Session["LoggedUserID"].ToString() + " AND AlarmTriggered = 'N' AND StartDate <= getDate()"; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = sqlStmt; cmd.Connection = conn; conn.Open(); using (SqlDataReader sdr = cmd.ExecuteReader()) { if (sdr.HasRows) { while (sdr.Read()) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); cell.Attributes.Add("width", "30"); cell.InnerHtml = " "; row.Cells.Add(cell); String CompanyName = company.getCompanyNameByID(sdr["CompanyID"].ToString()); cell = new HtmlTableCell(); cell.ColSpan = 3; cell.Attributes.Add("class", "alarm-heading-style"); cell.InnerText = "ALARM - " + CompanyName.ToUpper(); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("width", "20"); cell.InnerHtml = " "; row.Cells.Add(cell); tableContent.Rows.Add(row); row = new HtmlTableRow(); cell = new HtmlTableCell(); cell.ColSpan = 5; cell.InnerHtml = " "; row.Cells.Add(cell); tableContent.Rows.Add(row); row = new HtmlTableRow(); cell = new HtmlTableCell(); cell.Attributes.Add("width", "30"); cell.InnerHtml = " "; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.ColSpan = 3; cell.Attributes.Add("align", "left"); cell.Attributes.Add("class", "alarm-description"); cell.InnerText = sdr["Description"].ToString(); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("width", "30"); cell.InnerHtml = " "; row.Cells.Add(cell); tableContent.Rows.Add(row); row = new HtmlTableRow(); cell = new HtmlTableCell(); cell.ColSpan = 5; cell.InnerHtml = " "; row.Cells.Add(cell); tableContent.Rows.Add(row); row = new HtmlTableRow(); cell = new HtmlTableCell(); cell.Attributes.Add("width", "30"); cell.InnerHtml = " "; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("width", "200"); cell.Attributes.Add("class", "createdby"); cell.InnerText = "Created By: " + sdr["CreatedBy"].ToString(); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("width", "125"); cell.Attributes.Add("class", "alarm_buttons"); cell.Attributes.Add("onclick", "OpenCompany(" + sdr["CompanyID"].ToString() + "," + sdr["AlarmID"].ToString() + ")"); cell.InnerText = "OPEN COMPANY"; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("width", "125"); cell.Attributes.Add("class", "alarm_buttons"); cell.Attributes.Add("onclick", "DismissAlarm(" + sdr["AlarmID"].ToString() + ")"); cell.InnerText = "DISMISS ALARM"; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("width", "30"); cell.InnerHtml = " "; row.Cells.Add(cell); tableContent.Rows.Add(row); row = new HtmlTableRow(); cell = new HtmlTableCell(); cell.ColSpan = 5; cell.InnerHtml = "<hr/>"; row.Cells.Add(cell); tableContent.Rows.Add(row); } } } } conn.Close(); }
private void WriteReportTable(DataTable table) { HtmlTableRow tr = new HtmlTableRow(); tblReport.Rows.Add(tr); tr.Attributes["class"] = "DataGridHeader"; HtmlTableCell td = new HtmlTableCell(); tr.Cells.Add(td); td.InnerText = "ConnectionID"; td.Style["width"] = "120px"; td = new HtmlTableCell(); tr.Cells.Add(td); td.InnerText = "Stored Proc"; td.Style["width"] = "240px"; td = new HtmlTableCell(); tr.Cells.Add(td); td.InnerText = "Time"; td.Style["width"] = "50px"; td = new HtmlTableCell(); tr.Cells.Add(td); td.InnerText = "Status"; td.Style["width"] = "220px"; string rowClass = "DataGridRow"; foreach (DataRow row in table.Select("", "ConnectionID, StoredProc")) { rowClass = rowClass == "DataGridRow" ? "DataGridRowAlternate" : "DataGridRow"; tr = new HtmlTableRow(); tblReport.Rows.Add(tr); tr.Attributes["class"] = rowClass; td = new HtmlTableCell(); tr.Cells.Add(td); td.VAlign = "top"; if (!row.IsNull("ConnectionID")) { td.InnerText = row["ConnectionID"].ToString(); } td = new HtmlTableCell(); tr.Cells.Add(td); td.VAlign = "top"; td.InnerText = row["StoredProc"].ToString(); td = new HtmlTableCell(); tr.Cells.Add(td); td.Align = "right"; td.VAlign = "top"; if (!row.IsNull("Time")) { td.InnerText = row["Time"].ToString() + " ms"; } td = new HtmlTableCell(); tr.Cells.Add(td); td.VAlign = "top"; if (!row.IsNull("Status")) { td.InnerText = row["Status"].ToString(); } } }
/// <summary> /// showOrder displays the OrderItems in a table /// using HTMLTextWriter /// Adapted from Russell Text chapter 10 /// </summary> /// <param name="values"></param> private void showOrder(ICollection values) { double total = 0; HtmlTable tbl = new HtmlTable(); //StringBuilder sb = new StringBuilder(3000); //StringWriter sw = new StringWriter(sb); // HtmlTextWriter htw = new HtmlTextWriter(sw); HtmlTableRow row; HtmlTableCell cell; tbl.Border = 1; tbl.Align = "left"; // Now add a Cell for each property and item // there are 5 cells per row foreach (OrderItem item in values) { row = new HtmlTableRow(); tbl.Rows.Add(row); cell = new HtmlTableCell(); cell.Attributes.Add("style", "color:black; " + "background:lightYellow"); cell.Align = "Right"; cell.InnerText = item.ProductID.ToString(); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("style", "color:blue; background:lightYellow"); cell.Align = "Left"; cell.InnerText = item.ProductName.ToString(); row.Cells.Add(cell); double price = item.UnitPrice; int quantity = item.QuantityOrdered; double lineTotal = Math.Round(price * quantity, 2); total += lineTotal; cell = new HtmlTableCell(); cell.Attributes.Add("style", "color:black; " + "background:lightYellow"); cell.Align = "Right"; cell.InnerText = quantity.ToString(); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("style", "color:black; " + "background:lightYellow"); cell.Align = "Right"; cell.InnerText = price.ToString("F"); row.Cells.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("style", "color:black; " + "background:lightYellow"); cell.Align = "Right"; cell.InnerText = lineTotal.ToString("C"); row.Cells.Add(cell); cell = new HtmlTableCell(); Button newButton = new Button(); newButton.ID = item.ProductID.ToString(); newButton.Text = "Delete"; newButton.UseSubmitBehavior = true; newButton.Click += new EventHandler(newButton_Click); newButton.Visible = true; cell.Controls.Add(newButton); row.Cells.Add(cell); } // Now we need the Total // Mostly an empty row with nothing except the last cell row = new HtmlTableRow(); tbl.Rows.Add(row); // deadcell 1 cell = new HtmlTableCell(); row.Cells.Add(cell); // deadcell 2 cell = new HtmlTableCell(); row.Cells.Add(cell); // deadcell 3 cell = new HtmlTableCell(); row.Cells.Add(cell); // deadcell 4 cell = new HtmlTableCell(); row.Cells.Add(cell); // total cell cell = new HtmlTableCell(); cell.Attributes.Add("style", "color:black; " + "background:lightYellow"); cell.Align = "Right"; cell.InnerText = total.ToString("C"); row.Cells.Add(cell); tbl.EnableViewState = true; PlaceHolder1.Controls.Add(tbl); }
protected void Page_Load(object sender, EventArgs e) { SDKore.DomainModel.RepositoryFactory.SetTag(this.OrganizationName); Guid canalId = new Guid(); if (Request["id"] != string.Empty) { canalId = new Guid(Request["id"].ToString()); } //variavel usada para testes //canalId = new Guid("9484CD60-D400-E411-9420-00155D013D39"); if (canalId != null) { canal = new Domain.Servicos.ContaService(this.OrganizationName, false).BuscaConta((canalId)); if (canal == null) { mensagemRetorno.Text = "Canal não encontrado"; } else if (canal.ParticipantePrograma.Value.CompareTo(((int)Domain.Enum.Conta.ParticipaDoPrograma.Sim)) != 0) { mensagemRetorno.Text = "Canal / Conta não participante do Programa de Canais portanto sem configuração de portfólio"; ParticipantePrograma.Value = "0"; NomeOrganizacao.Value = this.OrganizationName; } else {//canal participante do programa GuidCliente.Value = canal.ID.ToString(); ParticipantePrograma.Value = "1"; NomeOrganizacao.Value = this.OrganizationName; //List<object> lstObjeto = new List<object>(); int index = 0; for (int i = 0; i < 30; i++) //foreach (Domain.Model.Product familia in familias) { index += 1; string strID = index.ToString(); #region Popula as linhas HtmlTableRow htr = new HtmlTableRow(); htr.Style.Add("background-color", CorDaLinha(index)); #endregion htr.Cells.Add(MontaCelula("NumNF " + index, "nota" + index, "label")); //Codigo htr.Cells.Add(MontaCelula("Serie " + index, "serie" + index, "label")); //Item htr.Cells.Add(MontaCelula("DtEmissao " + index, "dataEmissao" + index, "label")); //Item htr.Cells.Add(MontaCelula("Cnpj " + index, "cnpj" + index, "label")); //Item htr.Cells.Add(MontaCelula("Filial " + index, "filial" + index, "label")); //Item htr.Cells.Add(MontaCelula("VlrComImposto " + index, "valorComImposto" + index, "label")); //Item htr.Cells.Add(MontaCelula("VlrIPI " + index, "valorIPI" + index, "label")); //Item htr.Cells.Add(MontaCelula("VlrST " + index, "valorST" + index, "label")); //Item htr.Cells.Add(MontaCelula("VlrSemImposto " + index, "valorSemImposto" + index, "label")); //Item htr.Cells.Add(MontaCelula("Representante " + index, "representante" + index, "label")); //Item tblNF.Rows.Add(htr); } } } }
private void Fill() { string strSql = " SELECT a.*, b.NoUnit, c.Nama, d.Nama AS Agent, d.Principal FROM MS_KONTRAK a" + " INNER JOIN MS_UNIT b ON a.NoStock = b.NoStock" + " INNER JOIN MS_CUSTOMER c ON a.NoCustomer = c.NoCustomer" + " INNER JOIN MS_AGENT d ON a.NoAgent = d.NoAgent" + " WHERE a.ApprovalGN = 1" + " AND a.Status <> 'B'" ; DataTable rs = Db.Rs(strSql); if (rs.Rows.Count == 0) { save.Enabled = false; } for (int i = 0; i < rs.Rows.Count; i++) { if (!Response.IsClientConnected) { break; } HtmlTableRow tr; HtmlTableCell c; CheckBox cb; tr = new HtmlTableRow(); list.Controls.Add(tr); cb = new CheckBox(); cb.ID = "nokontrak_" + i; c = new HtmlTableCell(); c.ID = "pk_" + i; c.Attributes["title"] = rs.Rows[i]["NoKontrak"].ToString(); c.Controls.Add(cb); tr.Cells.Add(c); c = new HtmlTableCell(); c.InnerHtml = "<a href=\"javascript:popEditKontrak('" + rs.Rows[i]["NoKontrak"] + "')\">" + rs.Rows[i]["NoKontrak"].ToString() + "</a>"; tr.Cells.Add(c); c = new HtmlTableCell(); c.InnerHtml = rs.Rows[i]["NoUnit"].ToString(); tr.Cells.Add(c); c = new HtmlTableCell(); c.InnerHtml = rs.Rows[i]["Nama"].ToString(); tr.Cells.Add(c); c = new HtmlTableCell(); c.InnerHtml = rs.Rows[i]["Agent"].ToString() + "-" + rs.Rows[i]["Principal"].ToString(); tr.Cells.Add(c); c = new HtmlTableCell(); c.InnerHtml = rs.Rows[i]["Nama"].ToString() + " (" + rs.Rows[i]["NoCustomer"].ToString() + ")"; tr.Cells.Add(c); string customerbaru = Db.SingleString("SELECT Nama FROM MS_CUSTOMER WHERE NoCustomer='" + rs.Rows[i]["TempGN"].ToString() + "'"); c = new HtmlTableCell(); c.InnerHtml = customerbaru + " (" + rs.Rows[i]["TempGN"].ToString() + ")"; tr.Cells.Add(c); c = new HtmlTableCell(); c.InnerHtml = Cf.Num(Convert.ToDecimal(rs.Rows[i]["TempBiayaGN"])); c.Align = "right"; tr.Cells.Add(c); c = new HtmlTableCell(); c.InnerHtml = Cf.Num(Convert.ToDecimal(rs.Rows[i]["TempBiayaPPH"])); c.Align = "right"; tr.Cells.Add(c); } }
protected void Page_Load(object sender, EventArgs e) { //Load Book information HtmlTableRow row; HtmlTableCell cell; TextBox txtBox; int x = 0; row = new HtmlTableRow(); cell = new HtmlTableCell(); cell.InnerText = "Vote Preference"; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerText = "Author"; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerText = "Title"; row.Cells.Add(cell); tableContent.Rows.Add(row); SQLFunctions conn = new SQLFunctions(); //Check if user has already voted string currentUser = HttpContext.Current.User.Identity.Name; int userId = conn.getUserID(currentUser); if (conn.hasUserVoted(userId, 2019)) { tableContent.Visible = false; btnSubmit.Visible = false; ThankYouForVoting.Text = "You have already voted!"; ThankYouForVoting.Visible = true; } else { //int count = conn.getBookCount(); List <bookModel> book = conn.getBookAuthorTitle(2018); foreach (bookModel items in book) { x++; row = new HtmlTableRow(); cell = new HtmlTableCell(); txtBox = new TextBox(); //txtBox.ID = x.ToString(); txtBox.Width = 50; cell.Controls.Add(txtBox); row.Cells.Add(cell); //cell.InnerText = "Vote!"; //row.Cells.Add(txtBox); cell = new HtmlTableCell(); cell.InnerText = items.bookAuthor; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerText = items.bookTitle; row.Cells.Add(cell); tableContent.Rows.Add(row); } } }
private void AddFormFooter(Panel p) { using (HtmlTable htmlTable = new HtmlTable()) { using (HtmlTableRow row = new HtmlTableRow()) { using (HtmlTableCell labelCell = new HtmlTableCell()) { labelCell.Attributes.Add("class", "label-cell"); row.Cells.Add(labelCell); } using (HtmlTableCell controlCell = new HtmlTableCell()) { controlCell.Attributes.Add("class", "control-cell"); if (this.IsModal()) { this.useButton = new Button(); this.useButton.ID = "UseButton"; this.useButton.Text = Titles.Use; this.useButton.OnClientClick = "scrudDispalyLoading();"; this.useButton.Click += this.UseButton_Click; this.useButton.CssClass = this.GetButtonCssClass(); controlCell.Controls.Add(this.useButton); } this.saveButton = new Button(); this.saveButton.ID = "SaveButton"; this.saveButton.Text = Titles.Save; this.saveButton.OnClientClick = "return(scrudClientValidation());"; this.saveButton.Click += this.SaveButton_Click; this.saveButton.CssClass = this.GetSaveButtonCssClass(); controlCell.Controls.Add(this.saveButton); this.cancelButton = new Button(); this.cancelButton.ID = "CancelButton"; this.cancelButton.Text = Titles.Cancel; this.cancelButton.CausesValidation = false; this.cancelButton.OnClientClick = "$('#FormPanel').hide(500); $('#GridPanel').addClass('ui loading segment').show(500);"; this.cancelButton.Click += this.CancelButton_Click; this.cancelButton.CssClass = this.GetButtonCssClass(); controlCell.Controls.Add(this.cancelButton); using (HtmlInputReset resetButton = new HtmlInputReset()) { resetButton.Value = Titles.Reset; resetButton.Attributes.Add("class", this.GetButtonCssClass()); controlCell.Controls.Add(resetButton); } row.Cells.Add(controlCell); htmlTable.Rows.Add(row); p.Controls.Add(htmlTable); } } } }
public void LoadControlFromObject(ENTBaseWorkflowEO baseWorkflowEO, int currentUserId) { this.EnsureChildControls(); //Select the user for the group for (int row = 1; row < tblWFUserGroups.Rows.Count; row++) { HtmlTableRow tr = tblWFUserGroups.Rows[row]; //The owner group id is an attribute in the first cell int entWFOwnerGroupId = Convert.ToInt32(tr.Cells[0].Attributes["ENTWFOwnerGroupId"]); var ddlUsers = (DropDownList)tr.Cells[1].Controls[0]; //Select the correct record. var itemOwner = baseWorkflowEO.WFOwners.GetByENTWFOwnerGroupId(entWFOwnerGroupId); if (itemOwner.ENTUserAccountId == null) { ddlUsers.SelectedIndex = 0; } else { ddlUsers.Items.FindByValue(itemOwner.ENTUserAccountId.ToString()).Selected = true; } } //Set the current state label. lblCurrentState.Text = baseWorkflowEO.CurrentState.StateName + " (" + baseWorkflowEO.CurrentOwnerUserName + ")"; if (baseWorkflowEO.WFTransitions.Count == 0) { //Hide Transitions lblActions.Visible = false; ddlTransitions.Visible = false; } else { //Load the transition drop down ddlTransitions.DataSource = baseWorkflowEO.WFTransitions; ddlTransitions.DataTextField = "DisplayText"; ddlTransitions.DataValueField = "ID"; ddlTransitions.DataBind(); } //If this is a new item then there must be a transition picked. if (baseWorkflowEO.ID != 0) { ddlTransitions.Items.Insert(0, new ListItem("", "0")); //If this is an existing item and the current user is not the current owner then do not let them //transition the item. if (currentUserId != baseWorkflowEO.CurrentOwnerENTUserAccountId) { lblActions.Visible = false; ddlTransitions.Visible = false; } } //Load the state history grid cgvWFStateHistory.ListClassName = typeof(ENTWFItemStateHistoryEOList).AssemblyQualifiedName; cgvWFStateHistory.LoadMethodName = "Load"; cgvWFStateHistory.LoadMethodParameters.Add(baseWorkflowEO.WFItem.ID); cgvWFStateHistory.SortExpressionLast = "InsertDate"; //Name cgvWFStateHistory.AddBoundField("StateName", "State", ""); cgvWFStateHistory.AddBoundField("OwnerName", "Owner", ""); cgvWFStateHistory.AddBoundField("InsertDate", "Date", ""); cgvWFStateHistory.AddBoundField("InsertedBy", "Moved By", ""); cgvWFStateHistory.DataBind(); }
private void GetTimepoints() { int nStudyID; if (IsPostBack) { nStudyID = Convert.ToInt32(hidStudyID.Value.ToString()); } else { nStudyID = Convert.ToInt32(Request["StudyID"].ToString()); } hidStudyID.Value = nStudyID.ToString(); SqlCommand oCmd = new SqlCommand(); oCmd.Connection = Master.SqlConn; oCmd.CommandTimeout = 90; oCmd.CommandType = CommandType.StoredProcedure; oCmd.CommandText = "spGetTimepointsByStudyID"; oCmd.Parameters.Add(new SqlParameter("@StudyID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Default, nStudyID)); SqlDataReader oReader = oCmd.ExecuteReader(); HtmlTableRow oTr; HtmlTableCell oTd; int nRowCount = 0; bool bDisplayedHeader = false; while (oReader.Read()) { if (!bDisplayedHeader) { #region Display Column Headers oTr = new HtmlTableRow(); oTr.Attributes["class"] = "trHeader"; oTd = new HtmlTableCell(); oTd.InnerHtml = "Timepoint"; oTr.Cells.Add(oTd); oTd = new HtmlTableCell(); oTd.InnerHtml = "Timepoint_text"; oTr.Cells.Add(oTd); oTd = new HtmlTableCell(); oTd.InnerHtml = "Months_offset"; oTr.Cells.Add(oTd); oTd = new HtmlTableCell(); oTd.InnerHtml = "Default_vrpID"; oTr.Cells.Add(oTd); tblMaster.Rows.Insert(nRowCount + 1, oTr); bDisplayedHeader = true; #endregion } #region Display the Form Controls for Each Timepoint oTr = new HtmlTableRow(); oTd = new HtmlTableCell(); oTd.InnerHtml += "<input type=\"text\" name=\"txtTimepoint\" value=\"" + oReader["Timepoint"].ToString() + "\" style=\"width: 50px;\" maxlength=\"5\" id=\"txtTimepoint" + oReader["TimepointID"].ToString() + "\" />"; oTr.Cells.Add(oTd); oTd = new HtmlTableCell(); oTd.InnerHtml += "<input type=\"text\" name=\"txtTimepoint_text\" value=\"" + oReader["timepoint_text"].ToString() + "\" style=\"width: 100px;\" id=\"txtTimepoint_text" + oReader["TimepointID"].ToString() + "\" />"; oTr.Cells.Add(oTd); oTd = new HtmlTableCell(); oTd.InnerHtml += "<input type=\"text\" name=\"txtMonths_offset\" value=\"" + oReader["Months_offset"].ToString() + "\" style=\"width: 100px;\" id=\"txtMonths_offset" + oReader["TimepointID"].ToString() + "\" />"; oTr.Cells.Add(oTd); oTd = new HtmlTableCell(); oTd.InnerHtml += "<input type=\"text\" name=\"txtDefault_vrpID\" value=\"" + oReader["Default_vrpID"].ToString() + "\" style=\"width: 100px;\" id=\"txtDefault_vrpID" + oReader["TimepointID"].ToString() + "\" />"; oTd.InnerHtml += "<input type=\"hidden\" name=\"hidTimepointID\" value=\"" + oReader["TimepointID"].ToString() + "\" id=\"hidTimepointID" + oReader["TimepointID"].ToString() + "\" />"; oTr.Cells.Add(oTd); tblMaster.Rows.Insert(nRowCount + 2, oTr); #endregion nRowCount++; } oReader.Close(); }
/// <summary> /// ItemDataBound /// </summary> protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { string img, alt, publishedTask; HtmlTableRow tr = (HtmlTableRow)e.Item.FindControl("trList"); HtmlInputText txt = null; if (e.Item.ItemIndex % 2 == 0) { tr.Attributes.Add("class", "even"); } else { tr.Attributes.Add("class", "old"); } try { PNK_Banner data = (PNK_Banner)e.Item.DataItem; //Role Literal ltr = null; ltr = (Literal)e.Item.FindControl("ltrchk"); ltr.Text = string.Format(@"<INPUT class='txt' TYPE='checkbox' ID='cb{0}' NAME='cid[]' value='{1}' onclick='isChecked(this.checked);' >", e.Item.ItemIndex, data.Id); //Name ltr = (Literal)e.Item.FindControl("ltrName"); ltr.Text = data.Name; //Server.HtmlDecode(getScmplit(data.Lvl) + "• | " + data.Lvl + " | " + data.ProductCategoryDesc.Name); //Sort ltr = (Literal)e.Item.FindControl("ltrSort"); string strOrder = string.Empty; string onclick = string.Empty; //orderDown if (indexItem < this.pager.ItemCount - 1) { onclick = string.Format("onclick=\"listItemTask('cb{0}', 'orderdown')\"", e.Item.ItemIndex); strOrder += string.Format("<a title='{0}' {1} runat='server' style='cursor:pointer'><i class=\"glyphicon glyphicon-arrow-down\"></i></a> ", Constant.UI.admin_Down, onclick); } //orderUp if (indexItem > 0) { onclick = string.Format("onclick=\"listItemTask('cb{0}', 'orderup')\"", e.Item.ItemIndex); strOrder += string.Format("<a title='{0}' {1} runat='server' style='cursor:pointer'><i class=\"glyphicon glyphicon-arrow-up\"></i> </a> ", Constant.UI.admin_Up, onclick); } indexItem++; ltr.Text = strOrder; //Position ltr = (Literal)e.Item.FindControl("ltrPosition"); ltr.Text = GetPosition(data.Position); //image if (data.Published == "1") { img = "tick.png"; alt = LocalizationUtility.GetText(ltrAdminPublish.Text); // Constant.UI.admin_publish; publishedTask = "unpublish"; } else { img = "publish_x.png"; alt = ""; //LocalizationUtility.GetText(ltrAdminUnPublish.Text); publishedTask = "publish"; } DGCBannerControl banner = e.Item.FindControl("ucBanner") as DGCBannerControl; banner.FilePath = WebUtils.GetUrlImage("SliderUpload", data.Image, "SrcNoImage"); //Id HtmlInputButton btId = (HtmlInputButton)e.Item.FindControl("btId"); btId.Value = DBConvert.ParseString(data.Id); //set link HtmlAnchor hypImg = e.Item.FindControl("hypImg") as HtmlAnchor; HyperLink hdflink = new HyperLink(); hdflink = (HyperLink)e.Item.FindControl("hdflink"); hdflink.NavigateUrl = hypImg.HRef = template_path + LinkHelper.GetAdminLink("edit_slider", data.Id); //HtmlTableCell td = (HtmlTableCell)e.Item.FindControl("tdName"); //td.Attributes.Add("onclick", string.Format("listItemTask('cb{0}', 'edit')", e.Item.ItemIndex)); //td = (HtmlTableCell)e.Item.FindControl("trUpdateDate"); //td.Attributes.Add("onclick", string.Format("listItemTask('cb{0}', 'edit')", e.Item.ItemIndex)); ImageButton imgctr = (ImageButton)e.Item.FindControl("btnPublish"); imgctr.ImageUrl = string.Format("/Admin/images/{0}", img); imgctr.Attributes.Add("alt", alt); HtmlTableCell btn = (HtmlTableCell)e.Item.FindControl("tdbtn"); btn.Attributes.Add("onclick", string.Format(" return listItemTask('cb{0}', '{1}')", e.Item.ItemIndex, publishedTask)); } catch { } } }
/// <summary> /// Cambio la clase para mostrar el orden. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> protected void ItemDataBound_lvGeneric(object sender, ListViewItemEventArgs args) { ListView listView = (ListView)sender; //---------------------------------------------------- //-- 1 - Actualizo la URL del link para MapQuest //-- 2 - Veo si muestro o no la LUPA //---------------------------------------------------- if (args.Item.ItemType == ListViewItemType.DataItem && args.Item != null) { //-------------------------------------------------------------- //-- Creo el objeto que tiene los datos de la ROW del Listview //-------------------------------------------------------------- ListViewDataItem dataItem = (ListViewDataItem)args.Item; DataRowView rowView = (DataRowView)dataItem.DataItem; //-------------------------------------------------------------- //-- Si es un Administrador, no mostrar el boton eliminar //-------------------------------------------------------------- MembershipUser oUser = Membership.GetUser(rowView["UserName"].ToString()); if (oUser != null) { String[] roleForUser = Roles.FindUsersInRole("Administrador", oUser.UserName); ((ImageButton)dataItem.FindControl("btnDelete")).Visible = roleForUser.Length > 0 ? false : true; } if (bool.Parse(rowView["IsLockedOut"].ToString()) || !bool.Parse(rowView["IsApproved"].ToString())) { ((HtmlImage)dataItem.FindControl("imgBloqueado")).Visible = true; } else { ((HtmlImage)dataItem.FindControl("imgBloqueado")).Visible = false; } } //-------------------------------------------------------------- // Se dio clik en un HEADER para ordenar //-------------------------------------------------------------- if (listView.SortExpression.Length > 0) { // if this is the first time ItemDataBound has fired, figure out what column // is being sorted by if (!this._hasProcessedHeaderMain) { //-- Creo una referencia a la primera ROW = HEADERS de la //-- TABLA que se definio en el LAYOUT TEMPLATE !!! HtmlTableRow header = ((HtmlTable)listView.FindControl("tbGeneric")).Rows[0]; // Busco el LINKBUTTON que contenga en su CommandArgument el mismo // valor que el SortExpression del ListView for (int i = 0; i < header.Cells.Count; i++) { //-- Objeto Celda HtmlTableCell th = header.Cells[i]; // Busco el LINKBUTTON dentro de los // Controles de la Celda foreach (Control c in th.Controls) { LinkButton linkButton = c as LinkButton; if (linkButton != null) { string originalHeaderStyle = th.Attributes["class"] ?? string.Empty; // make sure the header doesn't have the sortasc or sortdesc classes th.Attributes["class"] = originalHeaderStyle.Replace("sortasc", string.Empty).Replace("sortdesc", string.Empty).Trim(); if (linkButton.CommandArgument == listView.SortExpression) { // add the sort class to this item th.Attributes["class"] = string.Format("{0} {1}", th.Attributes["class"] ?? string.Empty, listView.SortDirection == SortDirection.Ascending ? "sortasc" : "sortdesc").Trim(); } } } } this._hasProcessedHeaderMain = true; } } }
public override void BuildConfigForm(Control parentControl) { HtmlTable configTable = new HtmlTable(); configTable.CellPadding = 4; configTable.CellSpacing = 0; HtmlTableRow currentRow; HtmlTableCell currentCell; configTable.Attributes.Add("class", "inputForm"); configTable.Attributes.Add("style", "border:none"); //ADD CAPTION currentRow = new HtmlTableRow(); currentCell = new HtmlTableCell("th"); currentCell.Attributes.Add("class", "sectionHeader"); currentCell.ColSpan = 2; HyperLink gatewayLink = new HyperLink(); gatewayLink.Text = this.Name; gatewayLink.NavigateUrl = "http://www.paradata.com"; gatewayLink.Target = "_blank"; currentCell.Controls.Add(gatewayLink); currentRow.Cells.Add(currentCell); configTable.Rows.Add(currentRow); //ADD INSTRUCTION TEXT currentRow = new HtmlTableRow(); currentCell = new HtmlTableCell(); currentCell.ColSpan = 2; currentCell.Controls.Add(new LiteralControl("<p class=\"InstructionText\">To enable Paradata, you must provide your Paradata Account Token.</p>")); currentRow.Cells.Add(currentCell); configTable.Rows.Add(currentRow); //display assembly information currentRow = new HtmlTableRow(); currentCell = new HtmlTableCell("th"); currentCell.Attributes.Add("class", "rowHeader"); currentCell.Attributes.Add("style", "white-space:normal;"); currentCell.VAlign = "Top"; currentCell.Width = "50%"; currentCell.Controls.Add(new LiteralControl("Assembly:")); currentRow.Cells.Add(currentCell); currentCell = new HtmlTableCell(); currentCell.VAlign = "Top"; currentCell.Width = "50%"; Label lblAssembly = new Label(); lblAssembly.ID = "AssemblyInfo"; lblAssembly.Text = this.GetType().Assembly.GetName().Name.ToString() + " (v" + this.GetType().Assembly.GetName().Version.ToString() + ")"; currentCell.Controls.Add(lblAssembly); currentRow.Cells.Add(currentCell); configTable.Rows.Add(currentRow); //get Account Token currentRow = new HtmlTableRow(); currentCell = new HtmlTableCell("th"); currentCell.Attributes.Add("class", "rowHeader"); currentCell.Attributes.Add("style", "white-space:normal;"); currentCell.VAlign = "Top"; currentCell.Width = "50%"; currentCell.Controls.Add(new LiteralControl("Account Token:")); currentCell.Controls.Add(new LiteralControl("<br /><span class=\"helpText\">Your Paradata Account Token is required.</span>")); currentRow.Cells.Add(currentCell); currentCell = new HtmlTableCell(); currentCell.VAlign = "Top"; currentCell.Width = "50%"; TextBox txtAccountToken = new TextBox(); txtAccountToken.ID = "Config_AccountToken"; txtAccountToken.Columns = 70; txtAccountToken.MaxLength = 280; txtAccountToken.Text = this.AccountToken; currentCell.Controls.Add(txtAccountToken); currentCell.Controls.Add(new LiteralControl("<br />")); currentRow.Cells.Add(currentCell); configTable.Rows.Add(currentRow); //get Charge Type currentRow = new HtmlTableRow(); currentCell = new HtmlTableCell("th"); currentCell.Attributes.Add("class", "rowHeader"); currentCell.Attributes.Add("style", "white-space:normal;"); currentCell.VAlign = "Top"; currentCell.Width = "50%"; currentCell.Controls.Add(new LiteralControl("Authorization Mode:")); currentCell.Controls.Add(new LiteralControl("<br /><span class=\"helpText\">Use \"Authorize\" to request authorization without capturing funds at the time of purchase. You can capture authorized transactions through the order admin interface. Use \"Authorize & Capture\" to capture funds immediately at the time of purchase.</span>")); currentRow.Cells.Add(currentCell); currentCell = new HtmlTableCell(); currentCell.VAlign = "Top"; currentCell.Width = "50%"; RadioButtonList rblChargeType = new RadioButtonList(); rblChargeType.ID = "Config_UseAuthCapture"; rblChargeType.Items.Add(new ListItem("Authorize (recommended)", "false")); rblChargeType.Items.Add(new ListItem("Authorize & Capture", "true")); rblChargeType.Items[UseAuthCapture ? 1 : 0].Selected = true; currentCell.Controls.Add(rblChargeType); currentRow.Cells.Add(currentCell); configTable.Rows.Add(currentRow); //get gateway mode currentRow = new HtmlTableRow(); currentCell = new HtmlTableCell("th"); currentCell.Attributes.Add("class", "rowHeader"); currentCell.Attributes.Add("style", "white-space:normal;"); currentCell.VAlign = "Top"; currentCell.Width = "50%"; currentCell.Controls.Add(new LiteralControl("Gateway Mode:")); currentCell.Controls.Add(new LiteralControl("<br /><span class=\"helpText\">You can configure to use the gateway in Live mode or Test mode.</span>")); currentRow.Cells.Add(currentCell); currentCell = new HtmlTableCell(); currentCell.VAlign = "Top"; currentCell.Width = "50%"; RadioButtonList rblGatewayMode = new RadioButtonList(); rblGatewayMode.ID = "Config_UseTestMode"; rblGatewayMode.Items.Add(new ListItem("Live Mode", "false")); rblGatewayMode.Items.Add(new ListItem("Test Mode", "true")); rblGatewayMode.Items[UseTestMode ? 1 : 0].Selected = true; currentCell.Controls.Add(rblGatewayMode); currentRow.Cells.Add(currentCell); configTable.Rows.Add(currentRow); currentCell.Controls.Add(new LiteralControl("<br />")); //GET THE DEBUG MODE currentRow = new HtmlTableRow(); currentCell = new HtmlTableCell("th"); currentCell.Attributes.Add("class", "rowHeader"); currentCell.Attributes.Add("style", "white-space:normal;"); currentCell.VAlign = "Top"; currentCell.Width = "50%"; currentCell.Controls.Add(new LiteralControl("Debug Mode:")); currentCell.Controls.Add(new LiteralControl("<br /><span class=\"helpText\">When debug mode is enabled, the communication between AbleCommerce and Paradata is recorded in the store \"logs\" folder. Sensitive information is stripped from the log entries.</span>")); currentRow.Cells.Add(currentCell); currentCell = new HtmlTableCell(); currentCell.VAlign = "Top"; currentCell.Width = "50%"; RadioButtonList rblDebugMode = new RadioButtonList(); rblDebugMode.ID = "Config_UseDebugMode"; rblDebugMode.Items.Add(new ListItem("Off", "false")); rblDebugMode.Items.Add(new ListItem("On", "true")); rblDebugMode.Items[UseDebugMode ? 1 : 0].Selected = true; currentCell.Controls.Add(rblDebugMode); currentRow.Cells.Add(currentCell); configTable.Rows.Add(currentRow); //CREATE LITERAL CONTROL WITH HTML CONTENT parentControl.Controls.Add(configTable); }