Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug html.editorfor

I have a view that contains a

@Html.EditorFor(x=>x.Regions, "_Regions")

my problem is that the _Regions.cshtml partial isn't called in at all, I have a breakpoint but that is never reached and it's content never shown. is there anyone who know how I can debug and see where it is failing.

It was my understanding that the @Html.EditorFor(x=>x.Regions, "_Regions") will be called as soon as I reach it but as just a test I deleted the _Regions.cshtml from my views folder and nothing happened no error nothing at all, doing the same with a @Html.Partial, then I get an error, Am I missing something here?

When I replace the Editorfor, with the partial, then I get into the partial but was just wondering how can I use Editorfor with passing in a model.

Regards

ANSWER:

The view should be in the EditorTemplates folder, alongside all the partial that you will be returning

like image 394
Jack M Avatar asked Jun 07 '26 21:06

Jack M


1 Answers

To debug internal MVC code you need to setup symbol server in your visual studio. There is already a tutorial on StackOverflow How to step into MVC4 source code without building assembly

like image 51
Piotr Stapp Avatar answered Jun 10 '26 18:06

Piotr Stapp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!