Server Side Control ID's

Discussion in 'ASP .Net Web Controls' started by Lloyd Burley via .NET 247, Jun 5, 2004.

  1. Hoping someone here can help me.

    I'm trying to change the ID that gets rendered to the browser for a
    server side control

    Example:

    <asp:panel id="Panel5" runat="server">test</asp:panel>

    Renders as:

    <div
    id="_PageTemplate0_innerHolder__PageTemplate7_ProfileOptions_Panel5">t
    est</div>

    what I'd like to do is change the ID of the div or any other control
    back to it's original value(possibly using the ClientID attribute?),
    in this case Panel5. I would like this to happen ONLY if i haven't
    set a cssclass on the control, that way I can track which I know to
    be unique controls to a page and which aren't.

    I would like to use this method for 2 reasons.
    1. I use the ID's of controls for CSS layout of unique controls and
    classes for non-unique controls.
    2. I use a nested control template architecture which is a few levels
    deep, as can can probably see, the ID that is output to the browser
    is ugly and bloated and not in the spirit of the clean HTML I and my
    company try to employ.

    If anyone can help me out with this I'd be grateful

    --------------------------------
    From: Lloyd Burley

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>krGMkgpwrEaal2sq+LvvOQ==</Id>
     
    Lloyd Burley via .NET 247, Jun 5, 2004
    #1
    1. Advertising

  2. Don't use Panel webcontrol. Use something else. Lets say maybe you should
    create some Literal control and you have complete cntrol over its rendering.

    the thing why CLR changes to ClientID is that it assures uniqueness of the
    IDs on the page.

    But beside that you should find some other more usable way to achieve your
    goal. Not with ID changes...

    --
    RobertK
    { Clever? No just smart. }

    "Lloyd Burley via .NET 247" <> wrote in message
    news:#...
    > Hoping someone here can help me.
    >
    > I'm trying to change the ID that gets rendered to the browser for a
    > server side control
    >
    > Example:
    >
    > <asp:panel id="Panel5" runat="server">test</asp:panel>
    >
    > Renders as:
    >
    > <div
    > id="_PageTemplate0_innerHolder__PageTemplate7_ProfileOptions_Panel5">t
    > est</div>
    >
    > what I'd like to do is change the ID of the div or any other control
    > back to it's original value(possibly using the ClientID attribute?),
    > in this case Panel5. I would like this to happen ONLY if i haven't
    > set a cssclass on the control, that way I can track which I know to
    > be unique controls to a page and which aren't.
    >
    > I would like to use this method for 2 reasons.
    > 1. I use the ID's of controls for CSS layout of unique controls and
    > classes for non-unique controls.
    > 2. I use a nested control template architecture which is a few levels
    > deep, as can can probably see, the ID that is output to the browser
    > is ugly and bloated and not in the spirit of the clean HTML I and my
    > company try to employ.
    >
    > If anyone can help me out with this I'd be grateful
    >
    > --------------------------------
    > From: Lloyd Burley
    >
    > -----------------------
    > Posted by a user from .NET 247 (http://www.dotnet247.com/)
    >
    > <Id>krGMkgpwrEaal2sq+LvvOQ==</Id>
     
    Robert Koritnik, Jun 7, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page