当前位置: 首页>>代码示例>>C#>>正文


C# HtmlTableCell类代码示例

本文整理汇总了C#中HtmlTableCell的典型用法代码示例。如果您正苦于以下问题:C# HtmlTableCell类的具体用法?C# HtmlTableCell怎么用?C# HtmlTableCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HtmlTableCell类属于命名空间,在下文中一共展示了HtmlTableCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

 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);
 }
开发者ID:AJLoveChina,项目名称:workAtQmm,代码行数:32,代码来源:Default.aspx.cs

示例2: OnInit

    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);
    }
开发者ID:TCarmack,项目名称:Brentwood,代码行数:60,代码来源:SiteSettings.aspx.cs

示例3: CreateTableRow

    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);
    }
开发者ID:bpanjavan,项目名称:Blog,代码行数:32,代码来源:archive.aspx.cs

示例4: AddControl

    private static HtmlTableCell AddControl(JobControl_Get_Result control)
    {
        HtmlTableCell cell = new HtmlTableCell();
        Control c = new Control();

        switch (control.ControlTypeName)
        {
            case "TextBox":
                c = new TextBox();
                c.ID = control.JobControlID + control.ControlTypeName + control.ControlName;
                break;

            case "CheckBox":
                c = new CheckBox();
                c.ID = control.JobControlID + control.ControlTypeName + control.ControlName;
                break;

            case "ImageUpload":
                c = new FileUpload();
                c.ID = control.JobControlID + control.ControlTypeName + control.ControlName;
                break;
        }

        cell.Controls.Add(c);
        return cell;
    }
开发者ID:TCarmack,项目名称:Brentwood,代码行数:26,代码来源:WebUtils.cs

示例5: RenderAccounts

    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();
    }
开发者ID:dblock,项目名称:sncore,代码行数:27,代码来源:PlaceFriendsQueueView.aspx.cs

示例6: ContHTML

 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);
 }
开发者ID:PhilTheAir,项目名称:Aspnet,代码行数:29,代码来源:Default.aspx.cs

示例7: AddTableCell

 private HtmlTableCell AddTableCell(string innerHtml)
 {
     HtmlTableCell cell = new HtmlTableCell();
     cell.InnerHtml = innerHtml;
     cell.Align = "center";
     return cell;
 }
开发者ID:ivladyka,项目名称:OurTravels,代码行数:7,代码来源:SiteTableView.ascx.cs

示例8: ShowCampaignTable

    /// <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);

        }
    }
开发者ID:kerenmishael,项目名称:BusinessRealityFinalProject,代码行数:36,代码来源:Campaign.aspx.cs

示例9: Render

 /// <summary>
 /// Transfer object in html cell
 /// </summary>
 /// <param name="value">Object to render</param>
 /// <returns>Html cell</returns>
 public override HtmlTableCell Render(object value)
 {
     var isOn = (bool)Property.GetValue(value);
     var result = new HtmlTableCell();
     result.InnerHtml = isOn ? "Да" : "Нет";
     return result;
 }
开发者ID:MikhailAsyulev,项目名称:Finance,代码行数:12,代码来源:BooleanTemplate.cs

示例10: AddSiteCellInnerHTML

 private HtmlTableCell AddSiteCellInnerHTML(string name, string banner, string url)
 {
     HtmlTableCell cell = new HtmlTableCell();
     Panel pnl = new Panel();
     pnl.CssClass = "sitesbanerhome";
     if(IsSitePage)
     {
         pnl.CssClass = "sitespagebaner";
     }
     HyperLink hl = new HyperLink();
     hl.NavigateUrl = url;
     hl.Attributes["rel"] = "nofollow";
     hl.Target = "_blank";
     if (banner != "")
     {
         Image i = new Image();
         i.ImageUrl = Path.Combine(Utils.GaleryImagePath, banner);
         hl.Controls.Add(i);
     }
     else
     {
         hl.Text = name;
     }
     pnl.Controls.Add(hl);
     cell.Controls.Add(pnl);
     return cell;
 }
开发者ID:ivladyka,项目名称:OurTravels,代码行数:27,代码来源:SiteTableView.ascx.cs

示例11: AddRowIconClassName

 protected void AddRowIconClassName(string icon, HtmlTable table, HtmlTableRow row)
 {
     HtmlTableCell cell1 = new HtmlTableCell();
     cell1.InnerHtml = icon;
     row.Cells.Add(cell1);
     table.Rows.Add(row);
 }
开发者ID:mohamedwaelkaizen,项目名称:ajax-docs,代码行数:7,代码来源:DefaultCS.aspx.cs

示例12: AddItem

 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);
     
 }
开发者ID:uwitec,项目名称:ds568,代码行数:27,代码来源:Property.ascx.cs

示例13: LayoutColumns

  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";
  }
开发者ID:ClaireBrill,项目名称:GPV,代码行数:31,代码来源:ShowDeactivated.aspx.cs

示例14: Render

        /// <summary>
        /// Render object in html cell
        /// </summary>
        /// <param name="value">Object to render</param>
        /// <returns>Html table cell</returns>
        public override HtmlTableCell Render(object value)
        {
            var editWithList = (EditWithList)this.Property.GetValue(value);
            var result = new HtmlTableCell();
            result.InnerHtml += "<select class=\"chosen\">";
            var selectedOption = string.Empty;
            if (!string.IsNullOrEmpty(editWithList.SelectedValue))
            {
                editWithList.List.TryGetValue(editWithList.SelectedValue, out selectedOption);
            }

            foreach (var option in editWithList.List)
            {
                if (option.Value == selectedOption)
                {
                    result.InnerHtml += string.Format("<option selected=\"selected\" value=\"{0}\">{1}</option>", option.Key, option.Value);
                }
                else
                {
                    result.InnerHtml += string.Format("<option value=\"{0}\">{1}</option>", option.Key, option.Value);
                }
            }

            result.InnerHtml += "</select>";
            return result;
        }
开发者ID:MikhailAsyulev,项目名称:Finance,代码行数:31,代码来源:DropDownTemplate.cs

示例15: BuildCheckbox

    public List<HtmlTableCell> BuildCheckbox(string fieldtext, string id, string SkinID, int length, bool isReadOnly, string controlValue)
    {
        List<HtmlTableCell> c = new List<HtmlTableCell>();
        try
        {
            HtmlTableCell cell = new HtmlTableCell();
            cell.Attributes.Add("class", "tblFormViewtdLabel");
            cell.Style.Add("Width", "20%");
            ASPxLabel lb = new ASPxLabel();
            lb.Text = fieldtext;
            cell.Controls.Add(lb);
            HtmlTableCell celledit = new HtmlTableCell();
            celledit.Attributes.Add("class", "tblFormViewtdValue");
            celledit.Style.Add("Width", "30%");
            ASPxCheckBox cb = new ASPxCheckBox() { SkinID = SkinID, Text = "", ID = id, Checked = true, Width = Unit.Percentage(100), ReadOnly = isReadOnly };
            cb.Theme = "DevEx";
            cb.AutoPostBack = false;
            if (controlValue == "1")
                cb.Checked = true;
            celledit.Controls.Add(cb);

            c.Add(cell);
            c.Add(celledit);
            cot += 2;

        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(),
                                                            "<script> alert('buildCheckbox fieldname" + id + "'); </script>",
                                                            false);
        }
        return c;
    }
开发者ID:trantrung2608,项目名称:ilinkbay,代码行数:34,代码来源:DynamicForm.ascx.cs


注:本文中的HtmlTableCell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。