Friday, 27 September 2013

how to adding parameters to razor helpers

how to adding parameters to razor helpers

I want to know how write HTML Helper like @Html.TextBoxFor(model =>
model.signature) to have data-id parameter in produced input like below by
helper.
<input type="text" name="signature" data-id="No Signature" />
Note 1: parameter like dataId is work by htmlAttributes because it is a
simple variable.
Note 2: I know extended method and use attribute like @{var attributes =
new Dictionary<string, object>{{ "data-id", "blah" }};}
I feel that there is better way to solve this. Any idea...
Tnx a lot.

No comments:

Post a Comment