问题描述
作为 Web 标准极客,我不喜欢围绕我的整个网页的默认 <form runat="server">
.我已经看到许多基于 ASP.NET 的网页没有这些,所以看起来它可以在不带走任何功能的情况下被删除.怎么样?
As that web-standards geek I am, I dislike the default <form runat="server">
that surrounds my entire webpages. I've seen many ASP.NET based webpages that don't have these, so it seems like it can be removed without taking away any functionality. How?
推荐答案
如果你想使用控件的东西,就必须有一个 .否则回发是不可能的,viewstate 和 .NET 依赖的其他东西也是如此.
There will have to be a <form runat="server">
if you wish to use controls 'n stuff. Otherwise postbacks are impossible, as is viewstate and the rest of the stuff that .NET depends upon.
你确定你看到了你认为你看到的东西?也许这些页面只包含静态内容?或者它们可能是用户控件?或者另一种常见的可能性 - 也许是母版页具有 <form runat="server">
?
Are you sure you've seen what you've thought you've seen? Perhaps these pages only contained static content? Or perhaps they were user-controls? Or yet another common possibility - perhaps it was the Master Page that had the <form runat="server">
?
这篇关于如何摆脱“默认"来自 .aspx 页面的表单元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!