Asp.net 从其InsertItemTemplate子按钮获取FormView
我的网页上有一个FormView,当在FormView的InsertItemTemplate中按下提交按钮时,我试图获取FormView。我该怎么做呢。我的事件发送者是按钮,而不是窗体视图。它有什么属性吗?您应该能够通过按钮单击中的FV ID直接访问FVAsp.net 从其InsertItemTemplate子按钮获取FormView,asp.net,formview,Asp.net,Formview,我的网页上有一个FormView,当在FormView的InsertItemTemplate中按下提交按钮时,我试图获取FormView。我该怎么做呢。我的事件发送者是按钮,而不是窗体视图。它有什么属性吗?您应该能够通过按钮单击中的FV ID直接访问FV protected void Button1_Click(object sender, EventArgs e) { string id = FormView1.ID; //Here is an explicit
protected void Button1_Click(object sender, EventArgs e)
{
string id = FormView1.ID;
//Here is an explicit way to do get FV
//FormView fv = (FormView)((Button)sender).NamingContainer;
}
实际上FormView在中继器内。您是否尝试了第二种方法,即NamingContainer one??