GRIDVIEW中使用滚动条

在asp.net 2.0 beta中,在gridview中插入滚动条,其实是很简单的,在其中插入PANNEL控件,其中有scrollbar属性,如下例子:
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table style="border: 1px solid black;width:600px" cellpadding=0 cellspacing=0>

  <tr>

    <td width="193px" nowrap style="border-right: 1px solid black; height: 19px;">&nbsp;Customer ID</td>

    <td width="195px" nowrap style="border-right: 1px solid black; height: 19px;">&nbsp;Company Name</td>

    <td width="212px" nowrap style="height: 19px">&nbsp;Contact Name</td>

  </tr>

  <tr>

    <td colspan="3" width="600px" style="border-top: 1px solid black">

      <asp:Panel ID="Panel1" runat="server" Height="250px" ScrollBars="Vertical" Width="600px">

        <asp:GridView ShowHeader="false" ID="GridView1" runat="server" AutoGenerateColumns="False"

                      DataKeyNames="CustomerID" DataSourceID="SqlDataSource1">

           <Columns>

             <asp:BoundField ItemStyle-Width="200px" DataField="CustomerID" ReadOnly="True" />

             <asp:BoundField ItemStyle-Width="200px" DataField="CompanyName" />

             <asp:BoundField ItemStyle-Width="200px" DataField="ContactName" />

           </Columns>

        </asp:GridView>

        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="server=localhost;uid=sa;password=xxxx;database=northwind;" SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName] FROM [Customers]">

        </asp:SqlDataSource></asp:Panel>

    </td>

  </tr>

</table>


    </div>
    </form>
</body>
</html>

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值