Question

I am creaing a table cell, and in in, I want an image, and UNDER the image, a description. So, I attempted this:

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

However, what I end up with is the image, and NEXT to the image, a label. How would I ensure the label is under the image? I can't add a
.

Était-ce utile?

La solution

See if changing your code as below works for you.

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

I have added a br tag before the image description so that the image description will come in next line.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top