c# - Partial View: An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll -
i know there numerous posts couldn't seem fix error.
i getting above error (title) in partial view believe means have infinite loop not sure why happening. please see below:
homecontroller
public actionresult usertable() { manager = new manager(); var data = manager.getallusers(); var userdetails = u in data select new userdetail { userid = u.id, username = u.name, userlogin = u.login, firstname = u.firstname, surname = u.surname, email = u.email, active = convert.toint32(u.active), rightid = u.rightsid, groupid = u.groupsid, }; return view(userdetails.tolist()); }
usertable (partialview)
@model ienumerable<webapplication1.models.userdetail> @html.action("usertable") <br /> <div> <table class="table"> <thead> <tr> //table headers </tr> </thead> <tbody> @foreach (var item in model) { <tr> //various @html.displayfor() </tr> } </tbody> </table> </div>
index (view)
@{html.renderpartial("usertable");}
if want me clarify or want further details please not hesitate ask. thank in advance.
p.s error occuring in usertable method.
so found solution problem of hints stephen , alexander in comments. me if used render partial didn't execute method each partial view therefore returning null why tried html.action, causes infinite loop, if use render action solution execute methods, hope helps has same problem.
Comments
Post a Comment