Reference ASP.NET control by ID in JavaScript?

前端 未结 9 1204
孤街浪徒
孤街浪徒 2020-11-28 09:25

When ASP.NET controls are rendered their ids sometimes change, like if they are in a naming container. Button1 may actually have an id of ctl00_ContentMai

9条回答
  •  暖寄归人
    2020-11-28 10:25

    For 'ctl00_ContentMain_Button1' - In asp.net when page renders in the browser, first part remains same 'ctl00'. Second part is ID of ContentPlaceHolder used 'ContentMain'. Third is ID of a control 'Button1'

    I liked this http://codedotnets.blogspot.in/2012/01/how-get-id-server-control-javascript.html

提交回复
热议问题