Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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
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
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
.NET will also retain a .ClientID property for the control.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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
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
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
.NET will also retain a .ClientID property for the control.
is working on a reply...