user2138919
user2138919

Reputation:

HtmlHelpers in Asp.Net MVC

As we know that in asp.net mvc if we use

@HtmlTextbox("t1",Model.val)

then it will create html output as

<input type="text" value="Value of val in Model"/>

but rather using htmlhelpers in asp.net mvc if I directly use

<input type="text" value="@Model.val"/>

So which is better using htmlhelpers or directly html tags in asp.net mvc

Upvotes: 0

Views: 98

Answers (2)

Amit
Amit

Reputation: 15387

I think <input type="text"> is faster then the HTML helper .

but in case of validation I recommend HTML Helper it is automatically handle validation if provided in model.

else you need to handle validation in case of <input type="text">

Upvotes: 1

andypopa
andypopa

Reputation: 536

The version that requires least computing (the 2nd one) is faster, but the 1st one is more readable.

Upvotes: 0

Related Questions