ASP.NET 表单 - 表单名称\id 更改为 aspnetForm

发布于 2024-10-06 08:34:58 字数 321 浏览 0 评论 0原文

我有这段代码:

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

匿名的好友 2024-10-13 08:34:58

将表单标签上的“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.

浮光之海 2024-10-13 08:34:58

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.

扭转时空 2024-10-13 08:34:58

这可能是因为您正在使用母版页。如果确实需要,您可以动态更改 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文