我需要能够从SQL数据库中查看数据,并选择要打印的特定行(稍后再处理)。 考虑到我不需要在任何时候编辑数据,我只需要一个带有一个复选框的数据,哪个控件最好?
答案 0 :(得分:2)
最有可能是GridView:
<asp:SqlDataSource id="CustomersSource"
SelectCommand="SELECT CustomerID, CompanyName, FirstName, LastName FROM SalesLT.Customer"
ConnectionString="<%$ ConnectionStrings:AWLTConnectionString %>"
runat="server"/>
<asp:GridView id="CustomersGridView"
DataSourceID="CustomersSource"
AutoGenerateColumns="False"
EmptyDataText="No data available."
AllowPaging="True"
runat="server" DataKeyNames="CustomerID">
<Columns>
<asp:BoundField DataField="CustomerID" HeaderText="CustomerID"
InsertVisible="False" ReadOnly="True" SortExpression="CustomerID" />
<asp:BoundField DataField="CompanyName" HeaderText="CompanyName"
SortExpression="CompanyName" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName"
SortExpression="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="LastName"
SortExpression="LastName" />
</Columns>
</asp:GridView>