Forum Moderators: open
I have an ASP:TABLE that is defined through the row and cell collections that is 3 cells wide and 3 rows long. The Table is a fixed width. In each Cell I have an ImageButton, a Label and a button. I am displaying images with descriptions and a button with that to do some type of event driven thing. My question is, when there is 4 images the cells are fine in the first row until the second row. The one Cell is all the way off to the left. I was wondering how can you get it in the center. Secondly, if there is only one image it stretches all the way across the table and aligns it's contents to the left. --> That is really annoying. I am sure that I know why that is, and is because since the table is a fixed position the cell must span across it somehow since there is no other contents in the row. Although I am wondering how do you control that. How can you have a fixed table with some controls in it like I have, that is 3 X 3, and if there is enough data for only one cell....how do you center that one cell in the first table row. Anyhoo, if anyone has any good ideas it would be greatly appreciated :-)
<asp:table id="Table1" style="Z-INDEX: 112; LEFT: 192px; POSITION: absolute; TOP: 242px" runat="server" Visible="False" CssClass="imageTable" CellSpacing="15" CellPadding="15">
<asp:TableRow HorizontalAlign="Center">
<asp:TableCell CssClass="imageTableCells" ID="tblCell1" VerticalAlign="Middle" HorizontalAlign="Center">
<asp:ImageButton runat="server" ID="ibtnt1" OnClick="ibtn1_Click"></asp:ImageButton>
<br>
<asp:Label CssClass="imageTableCellText" runat="server" ID="lblinft1"></asp:Label>
<br>
<asp:Button CssClass="infoButton" Text=" " runat="server" ID="btn1" OnClick="btn1_Click"></asp:Button>
</asp:TableCell>
<asp:TableCell CssClass="imageTableCells" ID="tblCell2" VerticalAlign="Middle" HorizontalAlign="Center">
<asp:ImageButton runat="server" ID="ibtnt2" OnClick="ibtn2_Click"></asp:ImageButton>
<br>
<asp:Label CssClass="imageTableCellText" runat="server" ID="lblinft2"></asp:Label>
<br>
<asp:Button CssClass="infoButton" Text=" " runat="server" ID="btn2" OnClick="btn2_Click"></asp:Button>
</asp:TableCell>
<asp:TableCell CssClass="imageTableCells" ID="tblCell3" VerticalAlign="Middle" HorizontalAlign="Center">
<asp:ImageButton runat="server" ID="ibtnt3" OnClick="ibtn3_Click"></asp:ImageButton>
<br>
<asp:Label CssClass="imageTableCellText" runat="server" ID="lblinft3"></asp:Label>
<br>
<asp:Button CssClass="infoButton" Text=" " runat="server" ID="btn3" OnClick="btn3_Click"></asp:Button>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow HorizontalAlign="Center">
<asp:TableCell CssClass="imageTableCells" ID="tblCell4" VerticalAlign="Middle" HorizontalAlign="Center">
<asp:ImageButton runat="server" ID="ibtnt4" OnClick="ibtn4_Click"></asp:ImageButton>
<br>
<asp:Label CssClass="imageTableCellText" runat="server" ID="lblinft4"></asp:Label>
<br>
<asp:Button CssClass="infoButton" Text=" " runat="server" ID="btn4" OnClick="btn4_Click"></asp:Button>
</asp:TableCell>
<asp:TableCell CssClass="imageTableCells" ID="tblCell5" VerticalAlign="Middle" HorizontalAlign="Center">
<asp:ImageButton runat="server" ID="ibtnt5" OnClick="ibtn5_Click"></asp:ImageButton>
<br>
<asp:Label CssClass="imageTableCellText" runat="server" ID="lblinft5"></asp:Label>
<br>
<asp:Button CssClass="infoButton" Text=" " runat="server" ID="btn5" OnClick="btn5_Click"></asp:Button>
</asp:TableCell>
<asp:TableCell CssClass="imageTableCells" ID="tblCell6" VerticalAlign="Middle" HorizontalAlign="Center">
<asp:ImageButton runat="server" ID="ibtnt6" OnClick="ibtn6_Click"></asp:ImageButton>
<br>
<asp:Label CssClass="imageTableCellText" runat="server" ID="lblinft6"></asp:Label>
<br>
<asp:Button CssClass="infoButton" Text=" " runat="server" ID="btn6" OnClick="btn6_Click"></asp:Button>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell CssClass="imageTableCells" ID="tblCell7" VerticalAlign="Middle" HorizontalAlign="Center">
<asp:ImageButton runat="server" ID="ibtnt7" OnClick="ibtn7_Click"></asp:ImageButton>
<br>
<asp:Label CssClass="imageTableCellText" runat="server" ID="lblinft7"></asp:Label>
<br>
<asp:Button CssClass="infoButton" Text=" " runat="server" ID="btn7" OnClick="btn7_Click"></asp:Button>
</asp:TableCell>
<asp:TableCell CssClass="imageTableCells" ID="tblCell8" VerticalAlign="Middle" HorizontalAlign="Center">
<asp:ImageButton runat="server" ID="ibtnt8" OnClick="ibtn8_Click"></asp:ImageButton>
<br>
<asp:Label CssClass="imageTableCellText" runat="server" ID="lblinft8"></asp:Label>
<br>
<asp:Button CssClass="infoButton" Text=" " runat="server" ID="btn8" OnClick="btn8_Click"></asp:Button>
</asp:TableCell>
<asp:TableCell CssClass="imageTableCells" ID="tblCell9" VerticalAlign="Middle" HorizontalAlign="Center">
<asp:ImageButton runat="server" ID="ibtnt9" OnClick="ibtn9_Click"></asp:ImageButton>
<br>
<asp:Label CssClass="imageTableCellText" runat="server" ID="lblinft9"></asp:Label>
<br>
<asp:Button CssClass="infoButton" Text=" " runat="server" ID="btn9" OnClick="btn9_Click"></asp:Button>
</asp:TableCell>
</asp:TableRow>
</asp:table>
Also I am sorry that the code is so sloppy and hard to read above. The editor doesn't help on the spcaing and stuff on this forum. I would like to add that this table was attempted to be dynamically created and it's associated controls also, and it was pulled off with something that really left me in the dust, so I reverted back to my old sloppy way. So the constraints that I have now are as my big question above in my original post. With why I couldn't get it to be dynamic may be a question in the upcomming days on this forum. I try to take things one at a time....hehe. Thanks everyone so much!
How about if I give a rundown of that code. If you take only one TableRow in the table and the three controls in each three cells, you have really looked at the whole table. That is all it is. Just keep adding one to every cell. That is it really.