控件在TableCell中的位置

本文关键字:位置 TableCell 控件 | 更新日期: 2023-09-27 18:19:14

我正在创建一个表格单元格,在中,我想要一个图像,并在图像下,一个描述。所以,我尝试了这个:

                TableCell cell = new TableCell();
            ImageButton i = new ImageButton
                                {
                                    ImageUrl = image.fullThumbPath,
                                    PostBackUrl =
                                        "~/fulldisplay.aspx?imageId=" + image.visibleId + @"&r=" +
                                        GlobalVariables.RandomString(5)
                                };
            cell.Controls.Add(i);
            Label l = new Label
                    {
                        Text = image.description
                    };
            l.Style.Add("font-weight", "bold");
            cell.Controls.Add(l);
            row.Cells.Add(cell);

然而,我最终得到的是图像,图像的旁边是一个标签。我如何确保标签在图像下面?我不能添加

控件在TableCell中的位置

看看像下面这样修改代码是否适合你。

Label l = new Label
  {
     Text = "<br>" + image.description                     
}; 

我在图像描述之前添加了一个br标签,以便图像描述将在下一行显示