Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 400
Sagar Hirapara Avatar asked Dec 12 '22 16:12

Sagar Hirapara


1 Answers

you can use

<input type="text" name='@Html.NameFor(x => x.name)' value='@Model.name'>
like image 177
maxlego Avatar answered Jan 18 '23 22:01

maxlego