css - How do I style an ASP.NET HTML server control by ID? -
when create html server control
in asp.net 4.5 id
, use css
style id
, fails. when inspect source of aspx
page, shows asp.net
has changed control's id
. in instance...
<div id="passwordstatus" class="well well-sm" runat="server"> current </div>
...becomes...
<div id="article_passwordstatus" class="well well-sm"> current </div>
can reliably (and best practices in mind) create css
style #article_passwordstatus
instead? or should create one-use css
class it, like...
<div id="passwordstatus" class="well well-sm password-status"> current </div>
preferably, can still somehow use original id assigned?
note: not want convert web server control.
assuming .net 4 , greater, can use clientidmode
. html this
<div id="passwordstatus" class="well well-sm" runat="server" clientidmode="static"> current </div>
when using static
clientid value set value of id property. if control naming container, control used top of hierarchy of naming containers controls contains.
Comments
Post a Comment