I have got asp.net mvc 3 website, I want to add feedback feature to all pages.
I created the partial view for this purpose and render it in master layout.
@model FeedbackHelper
Name:<br />
@Html.TextBoxFor(o=>Model.Name)
for example in Questions page , MVC returns the exception because that page binded the POST entity, as far as I check in StackOverflow I have got 2 solution
- create a parent model and add POST and FeedbackHelper as properties
- use Tuple
at the moment, changing all models is too risky for me.
Is there any good solution ?!
You could use child actions. The idea is to define a specific controller action that will serve the partial view and then include it using the
@Html.Actionhelper in your Layout.So:
then you will of course have a partial in the Shared folder:
and include it in your Layout: