Well, I try to add a css stylesheet to my web part but it didn’t work… I read that there are many ways to a css file into a web part, but I didn’t understand them….
First I installed the Sharepoint 2010 Tools, to create a visual web part for sandboxing. After that I created an empty project and added a visual web part (sandbox) to the project. Just after that, I created a new folder in the visual web part and added the stylesheet file to them.
Now I will add this css file to my web part, but I don’t know how…
I read, that this I possible with:
<SharePoint:CssRegistration runat="server" Name="./Styles/Site.css" />
But Visual Studio tells me, that an assembly for ::Microsoft.SharePoint.WebControls.CssRegistration
is missing.
I use also use using Microsoft.SharePoint
;
What is the best way, to import a css file to a web part? The css file should just available for this web part.
It would be awesome, if someone could help me to understand, how to include a stylesheet.
Information: CssRegistration: Available in Sandboxed Solutions: No!
Greetz
<SharePoint:CssRegistration runat="server" Name="./Styles/Site.css" />
in the .ascx file, some code will automatically added to the .ascx.gcs file. Must i add theMicrosoft.SharePoint
assembly to the .ascx file? At the moment, the assembly is in the .ascx.gcs file.