asp.net - Control.ClientID with CSS -


Can CSS be used with control that generates client IDs and not regular IDs?

Now I can use the CSS class, but I want to know whether it is possible to use the ID:

  # DIVERSION ID #Label Control ID {Padding: 100px; Red color; }  

There is no good way to do this. Many developers use something like this:

  & lt; Style & gt; # & Lt;% = MyControl.ClientID% & gt; {Padding: 100px; } & Lt; / Style & gt;  

But obviously I'm not a big fan of it. It is very tagsy and fragile, starting with ASP.NET 4.0, you will be able to control the client ID of an element in the code, so that you can specify the ID for the elements that you know you will be using CSS or JS With the goal will be required.

In the meantime, I recommend using classes that the system I work on, we require classes and restrictions ID for client-side code (CSS or JS) because it Additional overhead is not worth it. Classes can work as well as ID - nothing is preventing you from having some unique (one-use) classes, and there is no real problem in working from this way of maintenance.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -