How to create a textbox (from toolbox) 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.
精彩评论