468,294 Members | 1,945 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,294 developers. It's quick & easy.

Why doesn’t Visual Studio Default.aspx file let me add HTML elements?

74 64KB
I am confuse about why Visual Studio 2017 doesn't let me add HTML elements into the Default.aspx, but what I do know is that under the Solution Explorer, I see master page and apparently they are bind to the content page (which is the Default.aspx). Also, I put a copy of my screenshots problems.

So my question is do I start putting content (HTML elements) inside of that master page first!
Aside from what I have mentioned above, I also notice that when I try to put basic HTML elements into the @page directive (Default.aspx file), it says "“Content is not supported outside of 'script' or 'asp:Content' Regions” ".
The only reason I know of these terms is because I research this problem. Here are the articles that I have researched. "Content Not Supposed to Be Outside 'Script' or 'asp:Content' Regions" https://msdn.microsoft.com/en-us/lib...v=vs.100).aspx

Here are the screenshots of master page and default.aspx files.




Attached Images
File Type: jpg problem 1.jpg (25.7 KB, 319 views)
File Type: jpg problem 2.jpg (47.0 KB, 279 views)
Sep 2 '17 #1
4 3667
dseals22
74 64KB
@Rabbit Do you think you can help me with my problem?
Sep 2 '17 #2
Frinavale
9,735 Expert Mod 8TB
A MasterPage contains the layout for your website which pages within your application can then use so that your layout is consistent.

Your master page will contain the HTML structure for your site. When you go to the pages within your site (like your Default.aspx page), the content from that aspx page will be used to populate placeholders in your MasterPage.

In your simple case, your Default.aspx uses the SiteMaster master page. This means that the Default.aspx file should NOT contain the <DOCTYPE>, <head> or <body> tags because it is already defined in your SiteMaster.
Sep 5 '17 #3
dseals22
74 64KB
@Frinavale,

Thanks for the advice, but I didn't even have to work with the SiteMaster file for what I was trying to accomplish. All I had to do was drag the control elements in the toolbox of VS into the Designer view of my Default.aspx file. I thought that my initial method of working with the web form was overly complicated and that was why.
Sep 5 '17 #4
Frinavale
9,735 Expert Mod 8TB
Did you unhook the site from the Default.aspx file?
Or did you remove the <html> tag from your Default.aspx page?

You were getting errors (or warnings) because cannot have 2 <html> tags in your generated HTML...the pictures of the Default.aspx and SiteMaster components that you posted showed that you would have generated invalid HTML.
Sep 11 '17 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by | last post: by
2 posts views Thread by cameron | last post: by
6 posts views Thread by Jeff Robichaud | last post: by
4 posts views Thread by rohinichandrap | last post: by
5 posts views Thread by thersitz | last post: by
3 posts views Thread by =?Utf-8?B?UGhpbCBKb2huc29u?= | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.