Reputation: 1
I am new to ListView and I tried to change the width of the columns (the table is huge). It appears that changing the style tag in the table isn't working. What can I do to reduce the table size to fit exactly on the screen?
<LayoutTemplate>
<table runat="server" id="table1" cellpadding="2" style="width:500px">
<tr id="tr1" runat="server" style="Background:yellow" >
<th id="th1" runat="server" style="Color:Blue"><asp:LinkButton id="link1" OnClick="link1_Click"
runat="server" style="Color:Blue">a</asp:LinkButton></th>
<th id="th2" runat="server" style="Color:Blue">b</th>
<th id="th3" runat="server" style="Color:Blue">c</th>
<th id="th4" runat="server" style="Color:Blue"> <asp:LinkButton id="link2" OnClick="link2_Click"
runat="server" style="Color:Blue"> d</asp:LinkButton> </th>
<th id="th5" runat="server" style="Color:Blue">e</th>
<th id="th6" runat="server" style="Color:Blue"> <asp:LinkButton id="link3" OnClick="link3_Click"
runat="server" style="Color:Blue">f</asp:LinkButton> </th>
<th id="th7" runat="server" style="Color:Blue">Edit</th>
<th id="th8" runat="server" style="Color:Blue">Delete</th>
</tr>
<tr runat="server" id="itemPlaceholder" />
</table>
</LayoutTemplate>
<ItemTemplate>
<tr id="tr2" runat="server" style="background:#D9D8E0">
<td> <asp:Label ID="Label1" runat="Server" Text='<%#Eval("flda") %>' /></td>
<td> <asp:Label ID="Label2" runat="Server" Text='<%#Eval("fldb") %>' /></td>
<td> <asp:Label ID="Label3" runat="Server" Text='<%#Eval("fldc") %>' /></td>
<td> <asp:Label ID="Label4" runat="Server" Text='<%#Eval("fldd") %>' /></td>
<td> <asp:Label ID="Label5" runat="Server" Text='<%#Eval("flde") %>' /></td>
<td> <asp:Label ID="Label6" runat="Server" Text='<%#Eval("fldf") %>' /></td>
<td> <asp:Button ID="button1" runat="Server" Text="Edit" CommandName="edit" /> </td>
<td> <asp:Button ID="button2" runat="Server" Text="Delete" CommandName="Delete" /></td>
</tr>
</ItemTemplate>
Upvotes: 0
Views: 49
Reputation: 179
Instead of passing the width in the style property.
<table runat="server" id="table1" cellpadding="2" style="width:500px">
Try adding the width property, kind of like the below.
<table cellpadding="2" width="500px" border="1" runat="server" id="table1">
Upvotes: 1