开发者

Manually adding text to html.ValidationSummary?

I am rather new to mvc2 and when following a writeup on data annotations and such, I came across a bit of code that let me manually 开发者_运维知识库add a line of text to the validation summary.

I've searched for the last 2 or 3 hours and I've come to the point where I think I'm just searching for the wrong thing. Its not custom validators I'm looking for, but something that I can call from the controller to add error messages.

Does anyone know what I'm talking about?

edit: clarified title a bit


Are you looking for:

ModelState.AddModelError("*", "There was an error processing your request")

MSDN - ModelStateDictionary.AddModelError Method (String, String)
MSDN - Validating Model Data in an MVC Application

HTHs,
Charles

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜