开发者

keyup or onclick event for checkbox generated server side

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();" })
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜