获取grid_rowcomman事件下模板列中的控件

  烈火网(LieHuo.Net)教程 获取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);
}
} 烈火站长网http://www.zhufu.la

  转自:http://www.cnblogs.com/taoxiaosan/

转载请注明:代码家园 » 获取grid_rowcomman事件下模板列中的控件

评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)