asp.net mvc - Is there a way to get a PartialView HTML content in the controller? -
i have partial view controller outputcache on need cache element.
then need render partialview in every page, first need string replacement.
so question is, howdo partial view in controller can manipulate content , string replacement before returning view?
thanks
no, don't this. controller should not render view, that's job of templating engine.
pass "replacement" values model partialview.
public actionresult someaction() { somemodelmodel = new somemodel(); // model return partialview(model); // partial view model }
and partial view:
@model somemodel <div>replace values @model.value instead of string.replace().</div>
Comments
Post a Comment