2014-07-26 22 views
0

我现在在做这个任务,而且我被困在这个问题上,从我的理解中,我必须添加一个buttonfield到我的gridview,它会更新状态,并减少我的数据库中的FabricStock。 我已经有了gridview,其他一切都完成了,我可以从我的sql中检索数据,现在只剩下buttonfield了,我应该如何开始做这件事? 我读过很多关于更新数据行的其他文章,但显然这些不是我想要的,我在buttonfield上的知识是oC#gridview buttonfield只有在按下时才需要更新数据行

这些是我的gridview aspx代码。

<asp:GridView ID="gvFabrics" runat="server" CellPadding="3" GridLines="None" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellSpacing="1" Font-Names="Lao UI" AutoGenerateColumns="False" Width="976px" AllowPaging="True" OnPageIndexChanging="gvFabrics_PageIndexChanging" PageSize="5"> 
     <Columns> 
     <asp:BoundField DataField="ProductionPlanID" HeaderText="Production Plan ID" /> 
      <asp:BoundField DataField="FashionStyleID" HeaderText="Fashion Style ID" /> 
      <asp:BoundField DataField="FabricID" HeaderText="Fabric ID" /> 
      <asp:BoundField DataField="WarehouseID" HeaderText="Warehouse ID" /> 
      <asp:BoundField DataField="PPStatus" HeaderText="Status" /> 
      <asp:BoundField DataField="PPFabricReqd" HeaderText="PP Fabric Reqd" /> 
      <asp:BoundField DataField="PPFabricIssued" HeaderText="PP Fabric Issued" /> 
      <asp:ButtonField ButtonType="Button" HeaderText="Update Fabric" Text="Update" /> 
     </Columns> 
     <FooterStyle BackColor="#C6C3C6" Font-Bold="True" ForeColor="Black" /> 
     <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" /> 
     <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" /> 
     <RowStyle BackColor="#DEDFDE" ForeColor="Black" /> 
     <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="#333333" /> 
     <SortedAscendingCellStyle BackColor="#F1F1F1" /> 
     <SortedAscendingHeaderStyle BackColor="#594B9C" /> 
     <SortedDescendingCellStyle BackColor="#CAC9C9" /> 
     <SortedDescendingHeaderStyle BackColor="#33276A" /> 
    </asp:GridView>` 

`

回答

相关问题