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


C# HtmlTable类代码示例

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


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

示例1: 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

示例2: Table

 protected Table(HtmlTable htmlTable, int headerRowCount, int footerRowCount)
 {
     Animate = _defaultAnimate;
     _htmlTable = htmlTable;
     _headerRowCount = headerRowCount;
     _footerRowCount = footerRowCount;
 }
开发者ID:jstangroome,项目名称:CodedUITable,代码行数:7,代码来源:Table.cs

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: CreateForm

    public HtmlTable CreateForm(int JobID, HttpServerUtility server)
    {
        List<JobInfo> info = Brentwood.ListJobInfoByJob(JobID);
        List<JobAsset> assets = Brentwood.ListJobAssetsByJobID(JobID);

        HtmlTable table = new HtmlTable();

        foreach (JobInfo item in info)
        {
            table.Rows.Add(CreateRow(item));
        }

        foreach (JobAsset item in assets)
        {
            table.Rows.Add(CreateAssetRow(item, server));
        }

        Job job = Brentwood.GetJob(JobID);
        List<HtmlTableRow> rows = AddAdditionalInfo(job);

        foreach(HtmlTableRow item in rows)
            table.Rows.Add(item);

        return table;
    }
开发者ID:TCarmack,项目名称:Brentwood,代码行数:25,代码来源:JobPage.aspx.cs

示例9: CreateTable

    public static HtmlTable CreateTable(int jobID)
    {
        HtmlTable table = new HtmlTable();
        List<JobControl_Get_Result> results = Brentwood.ListJobControlByJobType(jobID);

        foreach (JobControl_Get_Result r in results)
            table.Rows.Add(AddRow(r));

        table = AddStandardControls(table);

        return table;
    }
开发者ID:TCarmack,项目名称:Brentwood,代码行数:12,代码来源:WebUtils.cs

示例10: Execute

        public override void Execute(IDictionary<string, string> Parameters, Stream Output, TextWriter Text, BinaryWriter Bin)
        {
            Text.WriteLine("<html><head>");
            Text.WriteLine("<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">");
            Text.WriteLine("</head><body class=\"main\">");

            Config c = Root.Instance.ResourceManager.LoadConfig("config/global.config");

            HtmlTable t = new HtmlTable();

            foreach (DictionaryEntry kv in c.Table)
            {
                t.Rows.Add(new object[] { kv.Key.ToString(), kv.Value.ToString() });
            }
            Text.Write(t.ToString());

            Text.WriteLine("</body></html>");
        }
开发者ID:cody82,项目名称:spacewar-arena,代码行数:18,代码来源:web.cs

示例11: BuildDefaultCopies

 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;
 }
开发者ID:ranyaof,项目名称:gismaster,代码行数:18,代码来源:General.cs

示例12: Page_Load

    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);
    }
开发者ID:naynishchaughule,项目名称:ASP.NET,代码行数:20,代码来源:Programmatically.aspx.cs

示例13: AddRadToggleButtonWithIcon

    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);
    }
开发者ID:mohamedwaelkaizen,项目名称:ajax-docs,代码行数:20,代码来源:DefaultCS.aspx.cs

示例14: CreateForm

    public HtmlTable CreateForm(int JobID, HttpServerUtility server)
    {
        Job job = Brentwood.GetJob(JobID);
        List<JobInfo> info = Brentwood.ListJobInfoByJob(JobID);
        List<JobAsset> assets = Brentwood.ListJobAssetsByJobID(JobID);

        HtmlTable table = new HtmlTable();

        table.Rows.Add(CreateRow("Order ID No:", job.JobID.ToString()));

        foreach (JobInfo item in info)
            table.Rows.Add(CreateRow(item));

        table.Rows.Add(CreateRow("Estimated Delivery Date:", ((DateTime)job.PromiseDate).ToString("dd MMM yyyy hh:mm tt")));

        foreach (JobAsset item in assets)
            table.Rows.Add(CreateAssetRow(item, server));

        return table;
    }
开发者ID:TCarmack,项目名称:Brentwood,代码行数:20,代码来源:OrderCompletePage.aspx.cs

示例15: Initialize

        public void Initialize(HtmlTable htmlTable, HtmlCell[] htmlCells)
        {
            if (_htmlTable != null)
            {
                throw new InvalidOperationException("Row is already initialized.");
            }

            if (htmlCells.Select(c => c.RowIndex).Distinct().Count() != 1)
            {
                throw new ArgumentException("All cells must have the same RowIndex.", "htmlCells");
            }

            _htmlTable = htmlTable;
            RowIndex = htmlCells[0].RowIndex;

            ResetCache();
            foreach (var htmlCell in htmlCells)
            {
                _htmlCellCache.Set(htmlCell.ColumnIndex, htmlCell);
            }
        }
开发者ID:jstangroome,项目名称:CodedUITable,代码行数:21,代码来源:TableRow.cs


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