在表格单元格的右下角显示标签



我想在右下角分配一个标签。

我在C#代码中动态地做这件事。

 string css = ""; string cssDate="DateRightColumn"; string ="Main Content"
        Label l1 = new Label();
        tblCell = new HtmlTableCell();
        Panel pnl1 = new Panel();
        Panel pnlDate = new Panel();
        pnl1.Controls.Add(new LiteralControl(string.Format("<span>{0}</span>", value)));
        l1.Text = "hello"
        l1.CssClass = cssDate;
        pnl1.Controls.Add(l1);
        tblCell.Controls.Add(pnl1);
.DateRightColumn {
    bottom:0px;
    right:0px;
    font-size:8px;
    height:20px;
}

在这里,我得到了数据,l1=hello显示在底部,但不显示在右下角。有人能帮我怎么做到这一点吗?

我认为您错过了css类中的位置:

.DateRightColumn {
    position: absolute;
    bottom:0px;
    right:0px;
    font-size:8px;
    height:20px;
}

您还必须将postion: relative添加到控件中,您希望标签位于右下角,所以我认为这是您的HtmlTable。

最新更新