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>

你可能感兴趣的:(XHTML,asp.net,asp,vb,VB.NET)