How to get rid of the quot;defaultquot; form-element from a .aspx-page?(如何摆脱“默认来自 .aspx 页面的表单元素?)
问题描述
作为 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 页面的表单元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何摆脱“默认"来自 .aspx 页面的表单元素
基础教程推荐
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- WPF 模态进度窗口 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
