ContentPlaceHolderID added to all my field id's. how to control them?

前端 未结 2 1683
太阳男子
太阳男子 2021-01-16 04:38

I have aspx pages which uses repetative code. So i put them on a masterfile and referring that in all other files. I have used the in all other pages where i included maste

2条回答
  •  长情又很酷
    2021-01-16 05:27

    You can use ClientIDMode, but keep in mind that's only available in .NET 4.0 and above.

    
    
    

    Or in JavaScript:

    var userLabel = document.getElementById('<%=SelectedSport.ClientID%>');
    

    if you are trying to access the control in javascript, then using .ClientID is probably your best bet, as it doesn't require change in aspx page

提交回复
热议问题