0

我需要做的是能够从网格视图中删除一个项目,然后更新它被删除的记录集。

      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" Font-Size="X-Small">
                  <Columns>
            <asp:BoundField DataField="File" HeaderText="File" />
            <asp:BoundField DataField="Remove" HeaderText="Remove" />
        </Columns>
      </asp:GridView>

// 后端...

    private void BindGridview(ArrayList list)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("File");
        dt.Columns.Add("Remove");
        int c = list.Count;
        for (int i = 0; i < c; i++)
        {
            dt.Rows.Add();
            dt.Rows[i]["file"] = list[i].ToString();
            dt.Rows[i]["Remove"] = ""; // <--- Have a remove action here????
        }
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
4

0 回答 0