ASP.net中获得Gridview中的Detailsview控件的方法

 
protected void DetailsView_ItemInstering(object sender, DetailsViewInsertEventArgs e)
{
    Table GridViewTable = ((Table)GridView1.Controls[0]);

    DetailsView DetailsView1 = ((DetailsView)GridViewTable.Rows[0].FindControl("DetailsView1"));

    string name = ((TextBox)DetailsView1.Rows[0].Cells[1].Controls[0]).Text.Trim();
    string age = ((TextBox)DetailsView1.Rows[1].Cells[1].Controls[0]).Text.Trim();
}

你可能感兴趣的:(ASP.net,C#)