0

我用这样的数据表填充了gridview:

protected void btnEdit_Click(object sender, EventArgs e)
 {
    FillGrid();
 }

public void FillGrid() {
    foreach (ListItem item in lblType.Items)
    {
        if (item.Selected)
        {
            DataTable data = AppDataAccess.GetData(item.Value, txtid.Value);
            GridView1.DataSource = data;
            GridView1.DataBind();
        }
    }

}

无法像下面这样检索更新的数据,因为数据来自多个数据库表。

  protected void grdContact_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
    int index = GridView1.EditIndex;
    GridViewRow row = GridView1.Rows[index];
    TextBox t1 = row.FindControl("TextBox1") as TextBox;
    TextBox t2 = row.FindControl("TextBox2") as TextBox;
    string t3 = GridView1.DataKeys[e.RowIndex].Value.ToString();
    lblRecord.Text = "Updated record " + t1.Text + "," + t2.Text + "Value From Bound Field" + t3;
}

有没有办法可以从 Gridview 行动态检索更新的数据?提前致谢。

4

0 回答 0