我的 Button1 在面板内,我想访问 rowindex 以便隐藏该 Imagebutton。但是当我进入调试模式时, GridView1.SelectedIndex 有一个空值。请帮忙!
protected void Button1_Click1(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
if (row.RowIndex == Convert.ToInt32(GridView1.SelectedIndex))
{
ImageButton StopButton = (ImageButton)row.FindControl("stopImageButton");
ImageButton StartButton = (ImageButton)row.FindControl("startImageButton");
StopButton.Visible = true;
StartButton.Visible = false;
}
}
}
this.StopTimeNotesPanel_ModalPopupExtender.Hide();
}