I’m currently building from scratch an ASP.NET with C# website, using Visual Studio. I have an aspx file that references a couple of user controls (ascx) like this:
<%@ Register src="UserControls/CategoriesList.ascx" tagname="CategoriesList" tagprefix="uc2" %>
I am interested in customizing some elements on the page (e.g. labels, etc), so I included (immediately after the above line) a reference to my .CSS file:
<link rel="Stylesheet" type="text/css" href="Cinemax.css" />
After doing so, I got an error message:
Parser Error Message: Only Content controls are allowed directly in a
content page that contains Content controls.
The error specifically points to the <link rel.... (line of code inserted above.)
Is there a workaround so I can include [in the same file!] references to user controls, as well as to a CSS stylesheet? Many thanks in advance.
I suppose that you should put the line including css to the file in
<head></head>section of the page, so your file can look like this:Update: You wrote you use master page, so putting it in the
headsection there should solve the issue. It worked for you, so I’m writing it, so it can also be helpful for the other people who have a similar issue.