c# - Textbox not showing output in MVC -


this question has answer here:

i want show output in textbox in mvc. not displaying anything. used following code , attached screenshot below:

@html.textareafor(up => up.compileoutput)  foreach (compilererror comperr in results.errors)             {                 userprogram.compileoutput  = "line number " + comperr.line +                             ", error number: " + comperr.errornumber +                             ", '" + comperr.errortext + ";" +                             environment.newline + environment.newline;             }  return view(userprogram); 

output

error

the first image shows output binded particular textbox. in browser (image 2) shows nothing in textbox (red colour)

i wondering why did not got exception. return view(string) view string parameter name, not show text.

i suggest use viewbag instead. set error text in property name follow:

foreach (compilererror comperr in results.errors) {     userprogram.compileoutput  = "line number " + comperr.line +                                  ", error number: " + comperr.errornumber +                                  ", '" + comperr.errortext + ";" +                                  environment.newline + environment.newline; }  viewbag.errortext = userprogram.compileoutput; 

you can later on retrieve value calling viewbag.errortext razor view


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -