Manually controlling name attribute of tags for asp.net html controls
Posted on 2007-11-22
I'm writing a form to send credit card info to a payment gateway and the API requires me to include a number of hidden fields woth very specific names. So when asp.net prefixes my names with e.g. ctl00$ContentPlaceHolder1 rendering this html tag:
<input type="hidden" name="ctl00$ContentPlaceHolder1$shopid" id="ctl00_ContentPlaceHolder1_PaymentBox1_shopid" value="12xxxxxxxxxx" />
The form doesn't comply with the API spec and the transaction is rejected.
How do I force ASP.NET not to prefix the name attribute? Or how do I programatically set the value attribute of a plain html tag from my code behind file?