如何在ASP.NET中的转发器中修复标题和子标题

时间:2018-11-02 12:04:07

标签: css asp.net repeater

我正在尝试使用CSS(样式)参考的Repeater上下滚动时,如何解决标题和子标题。 link(https://www.aspdotnet-suresh.com/2015/03/aspnet-scrollable-repeater-control-with-fixed-column-header-using-css-in-csharp-vbnet.html),并且仅适用于单个标头但不适用于子标头,有什么方法可以做到这一点?

中继器

<input type="text" class="input" placeholder="Type your name">

<div class="output">
   <!-- typed value will be printed here -->
</div>

CS

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script>
        $(document).ready(function () {

            $("table").prepend("<tr style=' color: white;  background-color: #9494b9;'> <th>Column 1</th><th colspan='2'>Column 2</th><th colspan='2'>Column 3</th></tr>")
        })
    </script>
    <style type="text/css">
        #rpttable tr td
        {
            max-height:10%;
            }
        table {
            border-collapse: collapse;
            text-align: center;
        }
    </style>

    <asp:Repeater ID="rptDrugs" runat="server" >
                    <HeaderTemplate>
                        <table border="1" id="rpttable">
                            <tr style=" color: white;  background-color: #9494b9;">
                                <th scope="col" style="width: 80px"> &nbsp;</th>
                                <th scope="col" style="width: 80px">Dosage
                                </th>
                                <th scope="col" style="width: 120px">Drug
                                </th>
                                <th scope="col" style="width: 100px">Patient
                                </th>
                                <th scope="col" style="width: 100px">Date
                                </th>
                            </tr>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <tr>
                            <td>
                                <asp:Label ID="Label2" runat="server" Text="" />
                            </td>
                            <td>
                                <asp:Label ID="lblCustomerId" runat="server" Text='<%# Eval("Dosage") %>' />
                            </td>
                            <td>
                                <asp:Label ID="lblContactName" runat="server" Text='<%# Eval("Drug") %>' />
                            </td>
                            <td>
                                <asp:Label ID="lblCountry" runat="server" Text='<%# Eval("Patient") %>' />
                            </td>
                            <td>
                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("Date") %>' />
                            </td>
                        </tr>
                    </ItemTemplate>
                    <FooterTemplate>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>

0 个答案:

没有答案