Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Using partial views in Razor

How do I load a partial view from a cshtml file?

I thought I could use:
@Html.RenderPartial("razorFilename")

But it doees not yet work. Is this correct and pointing to an error in the format of my partial View?  What are the rules of a partial page's format?
ASKER CERTIFIED SOLUTION
Avatar of Member_6283346
Member_6283346

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of curiouswebster

ASKER

> I guess rules for partial views are the same as for layouts and other page

Well, there are certain sections a normal page must have that a partial can not have. I was hoping for a list.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I thought a partial view did not have a body tag? Maybe I was wrong.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I the _Layout.cshtml has a <Body> and a <Head> section, does that mean the partial page can not have one also? Or would the partial's take precedence?
"If the" is what I meant
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thakns!