-1

The toolbox says there is no usable control in this group?

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

Please explain.

koregan
  • 10,054
  • 4
  • 23
  • 36
software
  • 728
  • 6
  • 18
  • 39

1 Answers1

4

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.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • hello darin, i am new to asp.net mvc2. i am just creating sample programs. please tell me how do i get textbox and where do i type the html helper code – software Feb 18 '11 at 14:08
  • 2
    @software you may start here: http://www.asp.net/mvc. The site contains many tutorials and videos you might go through. – Darin Dimitrov Feb 18 '11 at 14:08