I want to add v-on:click or @click in like following html helper method:
@Html.TextBoxFor(x => x.ItnScanCaseCode, new { @id="txtid",@click = "onchangeevent();" })
How to do that?
I want to add v-on:click or @click in like following html helper method:
@Html.TextBoxFor(x => x.ItnScanCaseCode, new { @id="txtid",@click = "onchangeevent();" })
How to do that?
You could use a Dictionary
for htmlAttributes
like this:
@Html.TextBoxFor(x => x.ItnScanCaseCode, htmlAttributes: new Dictionary<string, object> {
{ "v-on:click", "onchangeevent()" },
{ "id", "txtid" }
})
You just have to use an underscore rather than a - razor will replace it with a hyphen. its a simple as that!!!
@Html.TextBoxFor(x => x.ItnScanCaseCode, new { @id="txtid",v_on:click = "onchangeevent();" })