我有一个包含 3 列(CompanyName、Volume、counter)的 Gridview 我希望计数器列是所有按钮,当用户单击按钮时,它会将计数器增加 1。我不确定如何正确设置更新命令。这是我到目前为止所拥有的:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display.">
<Columns>
<asp:BoundField DataField="CompanyName" HeaderText="CompanyName"
SortExpression="CompanyName" />
<asp:BoundField DataField="Volume" HeaderText="Volume"
SortExpression="Volume" />
<asp:ButtonField DataTextField="counter" HeaderText="counter"
ButtonType="button"/>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:LiquorStoreConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:LiquorStoreConnectionString1.ProviderName %>"
SelectCommand="SELECT [CompanyName], [Volume], [counter] FROM [Company]">
</asp:SqlDataSource>
我需要做的就是每次在该特定行上按下按钮时递增 1。