获取grid_rowcomman事件下模板列中的控件
public void gridview_rowcomman(object sender,EventAge e)
{
GridView grid = (GridView)e.CommandSource;
Label lblFID = (Label)grid.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0].FindControl("lblFID");
CheckBox check = (CheckBox)grid.Rows[Convert.ToInt32(e.CommandArgument)].Cells[0].FindControl("chkFID");
if (e.CommandName == "delComman")
{
bool flag = false;
if (check.Checked == true)
{
StringBuilder sb = new StringBuilder();
sb.Remove(0, sb.Length);
sb.Append(sb.AppendFormat("delete from cf_sys_dic where fid='{0}'", lblFID.Text.Trim()));
flag = rc.PExcute(sb.ToString());
if (!flag)
ScriptManager.RegisterStartupScript(this, this.GetType(), "delTopic", "alert('对不起删除失败!');", true);
else
GridView1.DataBind();
}
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "delTopic", "alert('" + lblFID.Text.ToString() + "');", true);
}
}