如何动态检索gridview中的更新数据?

时间:2013-08-16 09:27:45

标签: c# asp.net gridview

我使用这样的数据表填充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行动态检索更新的数据? 提前谢谢。

0 个答案:

没有答案