如何在MVC中显示文本? [英] How to display the text in MVC?
本文介绍了如何在MVC中显示文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在MVC的文本框中显示错误消息.我为此使用了以下代码,但未显示.
I want to display the error message in a textbox in MVC. I used following code for that but its not displaying.
userProgram.CompileOutput = "Line number " + CompErr.Line +
", Error Number: " + CompErr.ErrorNumber +
", '" + CompErr.ErrorText + ";" +
Environment.NewLine + Environment.NewLine;
@Html.EditorFor(up => up.CompileOutput)
return View(userProgram);
在上面的代码中,userProgram返回CompileOutput的值.但它不会显示在文本框中.
In the above code userProgram returns the value for CompileOutput. But its not displaying in the textbox.
推荐答案
只需尝试
ModelState.Clear();
这篇关于如何在MVC中显示文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文