Reputation: 1751
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);
In the above code userProgram returns the value for CompileOutput. But its not displaying in the textbox.
Upvotes: 2
Views: 142
Reputation: 126
add this row top of view page.
@model YourNamespace.yourModel
and change this
@Html.EditorFor(model => model.CompileOutput)
Upvotes: 0
Reputation: 33306
If CompileOutput
is a string you could use the following:
@Html.TextBoxFor(up => up.CompileOutput)
If it is a complex object you need to define the EditorTemplate for that type.
Upvotes: 0
Reputation: 9947
why don't you try this to show textbox
@Html.TextBoxFor(up => up.CompileOutput)
Upvotes: 0