2013-07-22 98 views
0

我有一个天的问题。这是我的情况:从面板访问Gridview模板字段

我有一个Gridview Template字段这是一个ImageButton。单击ImageButton时,将打开一个模式pop up Panel。我的面板里面有一个取消按钮。

我想要的是当用户点击取消按钮。我将我的

ImageButton.Visible = true; 

但我似乎不能这样做,因为这个错误的

Unable to cast object of type WebControls.ContentPlaceHolder to type WebControls.GridViewRow

protected void Button1_Click1(object sender, EventArgs e) 
{ 
    Button button = sender as Button; 

    GridViewRow GridViewRow = (GridViewRow)button.NamingContainer; 
    GridViewRow.FindControl("stopImageButton").Visible = true; 
    this.StopTimeNotesPanel_ModalPopupExtender.Hide(); 
} 

请帮助

回答