如何摆脱“默认"来自 .aspx 页面的表单元素

How to get rid of the quot;defaultquot; form-element from a .aspx-page?(如何摆脱“默认来自 .aspx 页面的表单元素?)
本文介绍了如何摆脱“默认"来自 .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 页面的表单元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)
Bind multiple parameters from route and body to a model in ASP.NET Core(在ASP.NET Core中将路由和主体中的多个参数绑定到一个模型)
Custom model binding in AspNet Core WebApi?(AspNet Core WebApi中的自定义模型绑定?)
How to minify in .net core mvc view?(如何在.Net核心MVC视图中缩小?)