using cssclass with CSS IDs

  • Thread starter Thread starter DamienS
  • Start date Start date
D

DamienS

Hi,

Is there any way to use CSS class with the CSS ID (not to be confused
with the ASP ID)?

eg,

<style type="text/css">
#Table_01
{
position:relative;
blah blah...
}
</style>


Refering to those in 'normal' HTML, you'd use the ID property (as
opposed to class), eg
<div id="Table_01"></div>

I can't figure out how to set these on serverside controls.

Thanks very much in advance,



DamienS
 
DamienS said:
Hi,

Is there any way to use CSS class with the CSS ID (not to be confused
with the ASP ID)?

eg,

<style type="text/css">
#Table_01
{
position:relative;
blah blah...
}
</style>


Refering to those in 'normal' HTML, you'd use the ID property (as
opposed to class), eg
<div id="Table_01"></div>

I can't figure out how to set these on serverside controls.

Thanks very much in advance,



DamienS

It's not practical to use an id of a server control for css, as you have
to use the generated id. The html element that the control creates
doesn't get the id that the server control has, it gets an id that is
generated based on the controls parents.

You can get the generated id using the ClientID property of the server
control, but that means that you have to generate the css code using
server code.
 
don't use asp.net controls - then you have total control over client side
control id's.

I create subclassed asp.net server controls that allow one to specify that a
control should , based on its ID property value, render a raw id and/or name
or an asp.net mangled id - something that imho should have been built into
all controls right from the start.
 
Back
Top