开发者

How to create a textbox (from toolbox) in asp.net mvc2 web application?

开发者 https://www.devze.com 2023-02-12 09:30 出处:网络
The toolbox says there is no usable 开发者_如何学Ccontrol in this group? I have to create a textbox in asp.net mvc2 web application?

The toolbox says there is no usable 开发者_如何学Ccontrol in this group?

I have to create a textbox in asp.net mvc2 web application?

Please explain.


The toolbox is a habit that you might have learned from WebForms development but which no longer applies in ASP.NET MVC. In ASP.NET MVC you write code. And to generate a textbox (<input type="text" ...) you could use the TextBoxFor HTML helper:

<%= Html.TextBoxFor(x => x.SomeViewModelProperty) %>

or if you don't have a strongly typed view (although you should if you want a properly designed MVC application)

<%= Html.TextBox("SomeViewModelProperty") %>

So say goodbye to server controls and toolboxes and say hello to ASP.NET MVC.

0

精彩评论

暂无评论...
验证码 换一张
取 消