2014-07-26 21 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>` 

`

回答

相關問題