c# - Nested Html.Action calls in Razor -



c# - Nested Html.Action calls in Razor -

edit: vastly simplified version of site , if create test app, pattern works fine. in our real app, using t4mvc , within area. i'm guessing 1 of these factors causing issue...

edit2: default routes defined , if navigate straight /areaname/controllername/subchild?val=123 renders.

i have peculiar problem mvc , hoping can help...

i have controller next action methods

public actionresult index() { homecoming view(getmodel()); } public actionresult result child(string blah) { homecoming view(getmodel(blah)); } public actionresult result subchild(int val) { homecoming view(getmodel(val)); }

i have 3 razor views.

index.cshtml

<div> @html.action("child", new { blah = "raaa"}) </div>

child.cshtml

<div> @*error here*@ @html.action("subchild", new { val = 123}) </div>

subchild.cshtml

<h1>@model.val</h1>

when navigate / exception thrown saying "no route in route table matches supplied values." on html.action calling subchild action.

this within same area , same controller. if alter markup , utilize html.partial phone call kid view (and build model , pass in view), renders fine. issue comes when phone call html.action within view that's beingness rendered using html.action.

i've tried qualifying action using /area/controller/action, specifying controller in html.action call, passing area parameter in route values , combinations of of these.

does have ideas might be? i'm assuming can phone call html.action in views beingness rendered using it, guess might wrong...

well, out of box mvc 3 has default route parameter named id. subchild action has parameter named val, issue.

either rename parameter in action id, or add together new route

routes.maproute( "subchild", "{controller}/subchild/{val}", new { controller = "controllername", action = "subchild", val = urlparameter.optional } );

c# asp.net-mvc asp.net-mvc-3 razor

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -