Is there a strongly-named way to remove ModelState errors in ASP.NET MVC

后端 未结 3 1288
一向
一向 2020-12-06 10:33

Is there a way to remove ModelState errors during an ASP.NET MVC postback without having to write each one by hand.

Let\'s say we have a checkbox Billing Same

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 11:16

    Asp core 2.2 razor pages. Removes a nested objects modelstate(onpost) error in a list on type Input.ClubInfo.

            for (int i = 0; i < Input.ClubInfo?.Count; i++)
            {
                ModelState.Remove("Input.ClubInfo[" + i + "].Membershipnr2");
            }
    

提交回复
热议问题