我特别想要的是在gridview中找到详细视图,它位于gridview外面是否可能?我想在GridView RowCommand上发生这种情况。每次我试图找到它时,控件仍为空。
这就是我在做的事情:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName.Equals("edit"))
{
int id = Convert.ToInt32(e.CommandArgument);
string r = GridView1.DataKeys[id - 1].Value.ToString();
GridViewRow row = GridView1.Rows[id];
DetailsView dv = (DetailsView)ridView1.Rows[id].FindControl("DetailsView1"); // getting it as null
dv.DataSource = ds.Tables[0]; // Object refrence not set to instance of object: Error
dv.DataBind();
dv.Visible = true;
}
}