Does anyone know the syntax for setting a click event or keyup event on a checkbox in the following c# code? I'm trying to set the 3rd parameter htmlAttributes (after the 2nd parameter of true, see below:
Response.Write(Html.CheckBox("chkStatus_" + item.Value, true) + " "
开发者_运维知识库 + item.Text + "<br />");
This should do the trick:
<%= Html.CheckBox("chkStatus_" + item.Value, true,
new { onclick = "doSomething();" }); %>
or Razor
@Html.CheckBox("chkStatus_" + item.Value, true,
new { onclick = "doSomething();" })
精彩评论