I am working on an MVC 3 project. In my view I have textboxes and Text area which I am calling using @Html.TextBox/TextArea.
Can anyone please tell me, how can I define the onclick or onfocus even of these controls? I am unable to find a syntax for this.
@Html.TextBox("ControlName",
"Some Value",
new { onclick = "alert('Razor Engine')" });
@Html.TextBoxFor(m => m.Value, new
{
onclick = "alert('Razor Engine')",
@Value = "Some Value"
});
@Html.TextArea("ControlName",
"Some Value",
new { onclick = "alert('Razor Engine')" });
@Html.TextAreaFor(m => m.Value, new
{
onclick = "alert('Razor Engine')"
});