gpt4 book ai didi

asp.net-mvc - 如何从模型状态获取错误消息

转载 作者:行者123 更新时间:2023-12-05 00:42:34 25 4
gpt4 key购买 nike

我正在使用

modelstate.Adderror("test","test message")

我怎样才能在 Controller 本身中获得这个模型状态值。

就像我需要在 Controller 中获取“测试”的错误消息一样。

最佳答案

他在 Controller 中要求,我无法验证这一点,但我认为这只是类似于:

ModelState["test"].Value
ModelState["test"].Error
ModelState["test"]

以上其中之一。

关于asp.net-mvc - 如何从模型状态获取错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1998493/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com