开发者

ASP.NET MVC 2 Input ID

开发者 https://www.devze.com 2023-01-07 11:12 出处:网络
Adding the following to my view: <input type=开发者_开发知识库\"text\" runat=\"server\" id=\"newBookingRef\" name=\"newBookingRef\" />

Adding the following to my view:

<input type=开发者_开发知识库"text" runat="server" id="newBookingRef" name="newBookingRef" />

Results in the following HTML:

<input type="text" id="MainContent_newBookingRef" name="ctl00$MainContent$newBookingRef">

If I use the helper method Html.Textbox, the ID is generated as I would expect "newBookingRef".

How can I stop it prefixing the ID on standard input controls with the content placeholder id? I tried playing with the ClientIdMode of the content placeholder but this didn't seem to help.

Thanks, Ben


Remove the runat="server" attribute.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号