Avatar of M.L. Martin
M.L. Martin
Flag for United States of America

asked on 

Can't place center listview results in center of page.

I am trying to center the results of my ASP.Net ListView control with the rest of the items that are perfectly centered on the page. I've tried different settings but nothing seems to work. I do not want to go back to a gridview control. If I can get the listview centered it would be perfect. Here is my code below.

<asp:ListView ID="ListView1" runat="server" DataKeyNames="eid" DataSourceID="SqlDataSource2">
                   
                 
                   <EmptyDataTemplate>
                       <table runat="server" style="">
                           <tr>
                               <td>No data was returned.</td>
                           </tr>
                       </table>
                   </EmptyDataTemplate>
                 
                   <ItemTemplate>
                       <tr style="">
                           <%--<td>
                               <asp:Label ID="eidLabel" runat="server" Text='<%# Eval("eid") %>' />
                           </td>--%>
                           <td>
                               <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
                           </td>
                          <%-- <td>
                               <asp:Label ID="bodypartmgLabel" runat="server" Text='<%# Eval("bodypartmg") %>' />
                           </td>--%>
                       </tr>
                   </ItemTemplate>
                   <LayoutTemplate>
                       <table runat="server">
                           <tr runat="server">
                               <td runat="server">
                                   <table id="itemPlaceholderContainer" runat="server" border="0" style="">
                                       <tr runat="server" style="">
                                          <%-- <th runat="server">eid</th>--%>
                                           <th runat="server">Exercise Name</th>
                                           <%--<th runat="server">bodypartmg</th>--%>
                                       </tr>
                                       <tr id="itemPlaceholder" runat="server">
                                       </tr>
                                   </table>
                               </td>
                           </tr>
                           <tr runat="server">
                               <td runat="server" style="">
                                   <asp:DataPager ID="DataPager1" runat="server">
                                       <Fields>
                                           <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True" />
                                       </Fields>
                                   </asp:DataPager>
                               </td>
                           </tr>
                       </table>
                   </LayoutTemplate>
                   <SelectedItemTemplate>
                       <tr style="">
                           <td>
                               <asp:Label ID="eidLabel" runat="server" Text='<%# Eval("eid") %>' />
                           </td>
                           <td>
                               <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
                           </td>
                           <td>
                               <asp:Label ID="bodypartmgLabel" runat="server" Text='<%# Eval("bodypartmg") %>' />
                           </td>
                       </tr>
                   </SelectedItemTemplate>
               </asp:ListView>
centerlistview_results.JPG
ASP.NET* HTML 5

Avatar of undefined
Last Comment
M.L. Martin

8/22/2022 - Mon