自定义 DataGrid

    <style type="text/css">
.GridViewOverFlow table
{
 width:100%;
 table-layout:fixed; 
 border:2px;
}
.GridViewOverFlow table th
{
 /*align="center" nowrap="nowrap" valign="middle" style="overflow:hidden;"*/
 text-align:center; 
 vertical-align:middle;
 overflow:hidden;
    white-space:nowrap;
 word-break:keep-all;
 text-overflow:ellipsis;
}
.GridViewOverFlow table td
{
 /*width: 160px; float: left; white-space: nowrap; overflow: hidden;
word-break: keep-all;text-overflow: ellipsis;*/
 text-align:center;
 vertical-align:middle;
 white-space:nowrap;
 overflow:hidden;
 word-break:keep-all;
 text-overflow:ellipsis;
}
</style>

 

<asp:DataGrid ID="mygrid" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
        ShowFooter="True" Width="100%" CssClass="GridViewOverFlow">
        <Columns>
            <asp:TemplateColumn>
                <HeaderTemplate>
                    <table style="width: 100%; table-layout: fixed">
                        <caption>
                            图书信息管理
                        </caption>
                        <tr>
                            <th style="width:4em">
                                图书编号</th>
                            <th style="width:4em">
                                ISBN
                            </th>
                            <th style="width:8em">
                                名称
                            </th>
                            <th style="width:4em">
                                分类
                            </th>
                            <th style="width:8em">
                                作者
                            </th>
                            <th style="width:3em">
                                出版社
                            </th>
                            <th style="width:2em">
                                总数
                            </th>
                            <th style="width:3em">
                                可借数
                            </th>
                            <th style="width:4em">
                                被借次数
                            </th>
                            <th style="width:6em">
                                察看详细信息</th>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr align="center" valign="middle">
                        <td>
                            <asp:Label ID="BookIdLabel1" runat="server" Text='<%# Bind("BookId") %>'></asp:Label></td>
                        <td>
                            <asp:Label ID="BookISBNTextBox" runat="server" Text='<%# Bind("BookISBN") %>'></asp:Label></td>
                        <td>
                            <asp:Label ID="BookNameTextBox" runat="server" Text='<%# Bind("BookName") %>'></asp:Label></td>
                        <td>
                            <asp:Label ID="BookSortTextBox" runat="server" Text='<%# Bind("BookSort") %>'></asp:Label></td>
                        <td>
                            <asp:Label ID="BookAuthorTextBox" runat="server" Text='<%# Bind("BookAuthor") %>'></asp:Label></td>
                        <td>
                            <asp:Label ID="BookPCTextBox" runat="server" Text='<%# Bind("BookPC") %>'></asp:Label></td>
                        <td>
                            <asp:Label ID="BookTotalNumTextBox" runat="server" Text='<%# Bind("BookTotalNum") %>'></asp:Label></td>
                        <td>
                            <asp:Label ID="BookUseableNumTextBox" runat="server" Text='<%# Bind("BookUseableNum") %>'></asp:Label></td>
                        <td>
                            <asp:Label ID="BookBorrowedNumTextBox" runat="server" Text='<%# Bind("BookBorrowedNum") %>'></asp:Label></td>
                        <td>
                            <asp:HyperLink ID="NavToDetailWb" runat="server" NavigateUrl="~/Try.aspx" Text="察看更多信息"></asp:HyperLink>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <tr>
                        <td>
                            <table width="100%">
                                <tr>
                                    <td>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:TemplateColumn>
        </Columns>
    </asp:DataGrid> 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值