asp.net mvc - Is current action a ChildAction? -
how can determine if current action childaction or routed main action? should check url , compare action's name? that's not nice, since it's dependent on routing patterns...
or should make 2 actions of same name, put childactiononly on 1 of them , have separate logic (mainly returning view() or partialview())? how overloads differentiated?
okay, other perspective: how make so, if it's childaction return partialview, otherwise full view?
you use ischildaction
property:
public actionresult index() { if (controllercontext.ischildaction) { // index action invoked child action using // @html.action("index") } ... }
Comments
Post a Comment