后台找前台服务器控件,客户端控件方法

protected void gvInfo_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            Button btnDel = e.Row.FindControl("btnDel") as Button;   //找服务器控件
            HtmlInputButton btnCheck = e.Row.FindControl("btnCheck") as HtmlInputButton; //找客户端控件
            if (btnDel != null)
            {
                string UseFlag = e.Row.Cells[8].Text;
                if (UseFlag == "0" || UseFlag == "1")
                {
                    btnDel.Enabled = true; //使用标志为0(不可用)或1(未发出) -- 删除按扭可用
                }
                else
                {
                    btnDel.Enabled = false;
                }
            }
            if (btnCheck != null)
            {
                string UseFlag = e.Row.Cells[8].Text;
                if (UseFlag == "2")
                {
                    btnCheck.Disabled = false; //使用标志为2(已发送) -- 核销按扭可用
                }
                else
                {
                    btnCheck.Disabled = true;
                }
            }
        }
原文地址:https://www.cnblogs.com/zhc088/p/1307094.html