I’ve got an MVC application with basic view:
myapp.com/category
and a switcher to second one:
myapp.com/category/list
App is used as independent one and as also in other application into iframe where src is: myapp.com/category. I want do not show page header when it is used into iframe, how can I achieve it? I was trying to add querystring, myapp.com/category?show=false, and set this as iframe src, but when I switch to the second view the parameter is not passed.
You could create a helper method to construct URLs that would keep the show parameter in place. For example:
Then in the views, for example:
Another option is to create add a value to the session on the first request, and use that instead. Ie, put some logic in the controller like this:
Then in the views, use
@Session["show"]instead of@Request.QueryString["show"]to decide whether you show the header.