混淆asp.net控件和html控件
我们计划在 ASP.net 项目中使用 Ajax。然而,我们仍然希望我们网站的会员面板能够在所有浏览器中运行。我们决定在某些必须独立于浏览器的形式中不使用 Ajax。
我现在很困惑我们是否应该使用 ASP.NET 控件或 HTML 控件或两者都使用?
我有两个问题:
- 使用这两种方法可能会遇到任何问题吗?
- 另外,考虑到效率和性能,哪一个更好?
We are plannning to use Ajax in our ASP.net project. However, we still want the member panel of our web site to work in all browsers. We have decided not to use Ajax in some forms where browser independence is must.
I am now confused with whether we should use ASP.NET controls or HTML controls or both?
I have two questions:
- Are there any problems that I might face using either of approach?
- Also which one is better considering efficiency and performance?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Asp.Net 控件(包括 ajax 控件)独立于浏览器,asp.net 将检测您的浏览器并尝试为该浏览器呈现最佳的 html/javascript。所以你很擅长服务器控制。
The Asp.Net Controls including the ajax controls are independent of browsers, asp.net will detect your browser and try to render the best html/javascript for that browser. So you are good with server controls.
如果您要在 ASP.NET 中实现该项目,那么所有需要通过服务器端代码访问的控件都需要是 ASP.NET 控件。那些静态且仅显示某些值的控件可以是 html 控件。
要点是 asp.net 控件被呈现为 html 控件...因此查看网页的客户端实际上获得了 html 控件。
对于 AJAX,请参阅此
If you are going to implement the project in asp.net then for all the controls that need to be accessed via code at server side needs to be asp.net controls. Those controls that are static and only displaying some value can be html controls.
The main point is that the asp.net controls are rendered to html controls... so the client who views the web-page actually gets the html controls.
For AJAX refer this
ASP 控件和 HTML 控件是互补的。
ASP 控件带来了诸如视图状态(控件在回发后保留其内容)、与数据表的绑定以及许多表示属性之类的编程设施。使用这些控件在时间和可维护性方面确实具有优势。他们还管理一些安全功能,例如 html 代码注入。 ASP 控件可以从页面隐藏代码进行控制和管理。
HTML 控件不属于本机 ASP.NET 页面进程。有时,拥有不希望 ASP.NET 负责和修改的特定控制是一件好事,但它不是 ASP.NET Web 应用程序的核心。
ASP controls and HTML controls as complementary.
ASP controls bring facilities for programming like the viewstate (the control keeps its content after a post back), the binding with datatable, and a lot of presentation properties. It is really an advantage in terms of time and maintainability to use these controls. They also manage some security feature like html code injection. ASP controls could be controled and managed from the code behind page.
HTML controls are out of the native ASP.NET page process. It is sometime a good thing to have particular control that you don't want ASP.NET take in charge and modify, but it is not the core of an ASP.NET web application.
如果您可以使用 HTML - 它总是更好 - 因为它更快。
据我所知,ASP 控件的使用应该适用于所有浏览器,但效率较低。
在做出决定之前,最好创建一个小示例并在某些浏览器上进行测试。
(我在浏览器和 Firefox 上都使用了 ajax,它可以工作)
If you can use HTML - it is always better - as it is much faster.
The use of ASP controls should work on all browsers as far as I know, but it less efficient.
Better create a small example and test it on some browsers before you decide.
(I've used ajax on both explorer and Firefox and it works)