Sagar Hirapara
Sagar Hirapara

Reputation: 1697

MVC-bind simple html textbox without use of html helper and Razor

I have one question regarding MVC (I am new to MVC)
My question is

In MVC with Razor for textbox we write like this

@Html.TextBoxFor(m=>m.name)

Now suppose I don't want to use Razor and html helper class. I want simple html input, like this

<input type="text" name='@Model.name' value='@Model.name'>

Is the above possible somehow?

Upvotes: 4

Views: 9524

Answers (1)

maxlego
maxlego

Reputation: 4914

you can use

<input type="text" name='@Html.NameFor(x => x.name)' value='@Model.name'>

Upvotes: 14

Related Questions