Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jing Ling 9 posts 29 karma points
    Nov 02, 2009 @ 09:30
    Jing Ling
    0

    How to get a clean id or name in user control?

    Hi All. I am using latest umbraco. I created a macro with user control. inside my user control, I have a hidden field like :

    <input id="cartXML" type="hidden" name = "cartXML" runat="server"/>

    But afterI bind this user control into umbraco and view the web page source code, it changed the my id and name. like:

     <input name="ctl00$ctl00$ctl00$ContentPlaceHolderDefault$MainContent$shoppingCart_7$cartXML" type="hidden" id="ctl00_ctl00_ctl00_ContentPlaceHolderDefault_MainContent_shoppingCart_7_cartXML" />

     

    How do I avoid that?

    Cheers

    Jing

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Nov 02, 2009 @ 09:38
    Dirk De Grave
    0

    You can't, it's the nature of asp.net (unless you're asp.net 4.0). You can still address your control in your codebehind as cartXML!

     

    Hope this helps.

    Regrads,

    /Dirk

     

  • Petr Snobelt 923 posts 1535 karma points
    Nov 02, 2009 @ 11:29
    Petr Snobelt
    0

    If you use jquery, you can add class and select by it, or take a look at http://www.west-wind.com/Weblog/posts/42319.aspx

     

  • Rich Green 2246 posts 4008 karma points
    Nov 02, 2009 @ 12:25
    Rich Green
    0

    .NET will also retain a .ClientID property for the control.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies