< asp:TextBox>VS<输入类型=“文本">VS Html.TextBox [英] <asp:TextBox> Vs <input type="text"> Vs Html.TextBox

查看:73
本文介绍了< asp:TextBox>VS<输入类型=“文本">VS Html.TextBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在asp.net应用程序中工作,添加了诸如表单元素,验证和从DB填充数据之类的功能.

I am working in asp.net application, adding functionalities like form elements, validation and populating data from DB.

  1. 我可以使用ASP:控件,但我想知道是否可以使用 HTML.TextBox < input type ="text">

如果我可以使用< input type ="text" Html.TextBox ,则使用它们与使用

If I can use <input type="text" or Html.TextBox what are the pros and cons of using them versus using

推荐答案

忘记ASP.NET MVC中的服务器端控件.在ASP.NET MVC中,所有包含 runat ="server" 的内容都是很大的 NO .无论如何都不会在Razor中工作.没有优缺点.服务器端控件绝对不能使用,因此没有可比较的东西.只需使用HTML帮助程序,例如 Html.EditorFor Html.TextBoxFor .

Forget about server side controls in ASP.NET MVC. Everything containing runat="server" is a big NO in ASP.NET MVC. Won't work in Razor anyways. There are no pros and cons. Server side controls should never be used so there's nothing to compare. Simply use HTML helpers such as Html.EditorFor and Html.TextBoxFor.

这篇关于&lt; asp:TextBox&gt;VS&lt;输入类型=“文本"&gt;VS Html.TextBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆