find control in page

后端 未结 9 1072
孤城傲影
孤城傲影 2020-12-11 02:37

HTML


    
9条回答
  •  -上瘾入骨i
    2020-12-11 03:23

    This is probably due to how ASP.NET names the client IDs for nested controls. Look at the page source and see exactly what ASP.NET is naming your control.

    For example, looking at my page I can see that the button within the content placeholder renders like this:

    
    

    In this case FindControl("ctl00$ContentPlaceHolder1$btn1") returns a reference to the Button.

提交回复
热议问题