Re: [WSG] styling auto-generated .net id values

2005-12-08 Thread Matthew Cruickshank




Rachel Radford wrote:

  I'm working with a page that has auto-generated html from a .net engine that
I then style up with css.  In this case I need to reference one item on the
page that has an id of #_1740__ctl2__1125.  When I style this up in Firefox
it works fine. But it seems that IE gets stuck somewhere on the underscores
and ignores the rule.  I can't change the underscores because it is .net
generated - even though yes, I know that underscores are not recommended as
id values.  Can anyone help me on how I would get around this?
  

Reference it via some method other than #ID, such as Class.

If you need need #IDs you could generate a div within your selected
frame by calling a function that optionally drawn html. Eg, (I haven't
done C# for months and don't have a place to test this)

In ASPX:

">
    ...


and in codebehind,

 protected void checkItem(object itemIndex)
    {
    int itemItemInt = int.parse(itemIndex);
    if(itemIndexInt == yourItemNumber)
       {
        return "";
       }
    }



.Matthew Cruickshank
http://holloway.co.nz/





Re: [WSG] styling auto-generated .net id values

2005-12-08 Thread Ben Wong
I'd recommend not styling with the generated ids and using classes instead.

On 12/9/05, Rachel Radford <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> Just wondering if anyone else has come across the following problem and if
> so, how they fixed it?
>
> I'm working with a page that has auto-generated html from a .net engine that
> I then style up with css.  In this case I need to reference one item on the
> page that has an id of #_1740__ctl2__1125.  When I style this up in Firefox
> it works fine. But it seems that IE gets stuck somewhere on the underscores
> and ignores the rule.  I can't change the underscores because it is .net
> generated - even though yes, I know that underscores are not recommended as
> id values.  Can anyone help me on how I would get around this?
>
> Thanks,
> Rachel
>
> p.s. I don't have the option of ditching IE support!!
>
>
> **
> The discussion list for  http://webstandardsgroup.org/
>
>  See http://webstandardsgroup.org/mail/guidelines.cfm
>  for some hints on posting to the list & getting help
> **
>
>


--
Ben Wong
e: [EMAIL PROTECTED]
w: http://blog.onehero.net
**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
**



RE: [WSG] styling auto-generated .net id values

2005-12-08 Thread Peter Williams
> From: Rachel Radford
>
> page that has an id of #_1740__ctl2__1125

Just to follow up on the underscore thing...

>From the W3C HTML 4.01 recommendation

"ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
followed by any number of letters, digits ([0-9]), hyphens ("-"),
underscores ("_"), colons (":"), and periods (".")."

So there's your problem, invalid markup, so no suprise when it
fails to function properly in use. You have to fix the server-side
generation of the bad IDs to have any real hope of this being able
to work reliably across a range of browsers, other than by good luck.

-- 
Peter Williams
**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
**



RE: [WSG] styling auto-generated .net id values

2005-12-08 Thread Peter Williams
> From: Rachel Radford
> 
> one item on the page that has an id of #_1740__ctl2__1125
> in Firefox it works fine. IE gets stuck somewhere on 
> the underscores and ignores the rule

ID and class names can't start with a number either, I wonder if
that is part of the problem, after the underscore the first char
is a number. It seems the only sensible and ongoing way of fixing
this is to generate IDs that aren't problematic. Fix the problem
at the source as it were.

-- 
Peter Williams
**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
**