2012-01-01 51 views
1

我正在创建一个表格单元格,并且在中,我想要一个图像,并且在图像下面有一个描述。所以,我尝试这样的:TableCell中的控制位置

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

不过,我最终得到的是形象,和旁边的图像,一个标签。我如何确保标签在图像下?我无法添加

回答

0

看看是否改变你的代码,如下所示。

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

我在图像描述之前添加了br标签,以便图像描述将出现在下一行。