ASP.NET 表单 - 表单名称\id 更改为 aspnetForm
我有这段代码:
<form Name="AddPlace" ID="AddPlace" action="AddPlace.aspx" class="niceform" method="post" runat="server">
当我尝试执行该代码时,我得到的是:
<form name="aspnetForm" method="post" action="AddPlace.aspx" id="aspnetForm" class="niceform">
它怎么会改变?
I have this code:
<form Name="AddPlace" ID="AddPlace" action="AddPlace.aspx" class="niceform" method="post" runat="server">
That when i try to execute the code i get this instead:
<form name="aspnetForm" method="post" action="AddPlace.aspx" id="aspnetForm" class="niceform">
How come it changes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将表单标签上的“clientidmode”属性设置为“static”,以防止框架使用“aspnetForm”覆盖您的名称/ID。这让我发疯了好几个小时。
Set "clientidmode" attribute to "static" on the form tag to prevent the framework from override your name/id with "aspnetForm". This was driving me nuts for hours.
ASP.NET Web 表单控制表单元素;例如,如果您尝试更改操作,ASP.NET 将忽略它并将其更改回来...为什么需要特定的 ID?为什么 aspnetForm 不能工作?
HTH。
ASP.NET web forms takes control over the form element; for instance, if you try to change the action, ASP.NET will ignore it and change it back... why do you need a specific ID? Why won't aspnetForm work?
HTH.
这可能是因为您正在使用母版页。如果确实需要,您可以动态更改 Action 属性:
如何动态更改MasterPage上aspnetForm的Action属性
It may be because you are using Master Pages. You can change the Action attribute dynamically if you really need to:
How to change Action attribute of the aspnetForm on MasterPage dynamically