locked
Equivalent assembly in .net Core RRS feed

  • Question

  • User1159247168 posted

    What is the equivalent assembly of System.Web.UI.WebControls.CheckBox in .net Core?

    I am trying to upgrade an application from >net framework 4.5 to .net Core

    Monday, September 3, 2018 8:16 AM

Answers

  • User-821857111 posted

    As I said in my reply to your other thread: https://forums.asp.net/t/2146445.aspx?Equivalent+assembly+in+ASP+Net+core, there are no server controls in ASP.NET Core. A checkbox is and HTML <input> element with its type set to "checkbox"

    <input type="checkbox" name="myCheckBox"  />

    You can also generate them from the input taghelper if the property of your model is a bool:

    <input asp-for="SendSpam" />

    Assuming that SendSpam is a boolean property on the model for the view or page (if you are using Razor Pages, which you should do), this will render:

    <input type="checkbox" name="SendSpam" id="SendSpam" />

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 4, 2018 12:24 PM