在使用了母版页的内容页内查找控件

来源:互联网 发布:刘备错过的人才 知乎 编辑:程序博客网 时间:2024/05/16 04:34
ContentPlaceHolder content = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
//上面这行是必须先把ContentPlaceHolder这个控件找出来

FormView fv = (FormView)content.FindControl("FormView1");
//接下来再把FormView1这个放在content里的控件找出来
Label mony = (Label)fv.FindControl("monyLabel");
Label ytm = (Label)fv.FindControl("ytmLabel");
//然后才是说到怎么去找你最终想要的! 
 
原创粉丝点击