@Html.CheckBoxFor(
    m => m.MyModel.MyBoolProperty, 
    new { 
        @class = "myCheckBox", 
        data_externalid = "23521"
    }
)

The _ will automatically be converted to - in the resulting markup:

<input type="checkbox" name="MyModel.MyBoolProperty" data-external />

And that's true for all Html helpers taking a htmlAttributes anonymous object as argument, not only the CheckBoxFor helper.

 

 

 

相关文章:

  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2022-03-09
  • 2021-04-24
  • 2021-06-26
  • 2021-09-25
  • 2021-09-07
猜你喜欢
  • 2021-08-06
  • 2021-12-14
  • 2021-09-12
  • 2021-04-19
  • 2022-12-23
  • 2021-07-02
  • 2021-10-20
相关资源
相似解决方案