Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tejas Pansuriya 3 posts 73 karma points
    Jul 04, 2023 @ 06:55
    Tejas Pansuriya
    0

    Umbraco BeginForm Input tag

    Can anyone tell me i am using Umbraco BeginForm and Input type CheckBox when i am select the checkbox then ModelState is Arrives False, and when i am not selection checkbox then ModelState Become true.

    Here i attached code

    public bool RememberMe { get; set; }

    @Html.CheckBoxFor(model => model.RememberMe)

    Can anyone help me?

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Jul 04, 2023 @ 10:32
    Huw Reddick
    1

    Hi Tejas,

    Could you provide some more detail please.

    What is the exact version of Umbraco you are using?

    Are you posting to a SurfaceController?

  • Tejas Pansuriya 3 posts 73 karma points
    Jul 10, 2023 @ 05:00
    Tejas Pansuriya
    0

    Hi Huw,

    Current Umbraco Version is 10.5.1 and i am using Surface Controller and BeginUmbracoForm.

    I will provide you full detail.

    @using (Html.BeginUmbracoForm

    @Html.CheckBoxFor(model => model.RememberMe)
    } this is my form when User Login.

    enter image description here

    This is my Surface Controller.

    public class LoginInfo { [Required] public string Email { get; set; } [Required] public string Password { get; set; } public bool RememberMe { get; set; } } this is Model class

    Now Issue is that when User Checkon RememberMe Box then in the Model state arriving Everytime False and when User Don't select Checkbox then Model state Arriving true but every time value arriving False.

    I have tried So many resorces but I am not getting answer.

    Can you please help me.

    Thanks in Advance.

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Jul 10, 2023 @ 07:25
    Huw Reddick
    0

    Unfortunately you code is a bit mangled so I am not able to see it correctly

Please Sign in or register to post replies

Write your reply to:

Draft