0

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="XEx02Quotation._Default" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
   <html>
     <head runat="server">
       <title></title>
     </head>
     <body>
     </body>
   </html> 
</asp:Content>

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 screenshot 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 article that I have researched. "Content Not Supposed to Be Outside 'Script' or 'asp:Content' Regions" AND https://msdn.microsoft.com/en-us/library/wtxbf3hh(v=vs.100).aspx

Here are the screenshot problems: enter image description here enter image description here

Felipe Augusto
  • 7,733
  • 10
  • 39
  • 73
User445555
  • 66
  • 1
  • 10
  • Maybe something related to putting a new HTML file inside the content? Can you try to put only a ```
    ``` or something else?
    – Felipe Augusto Sep 02 '17 at 02:32
  • @ Felipe Augusto What do you mean? – User445555 Sep 02 '17 at 02:36
  • The ```Default.aspx``` is inside the ```Site.Master```, which is a html page, and you're trying to define a html tag inside the ```Default.aspx```, if you try to put a div inside the ```Default.aspx``` the same happens (error)? – Felipe Augusto Sep 02 '17 at 02:39
  • @Felipe Augusto Yes, the same thing happens! – User445555 Sep 02 '17 at 02:41
  • In my Default.aspx I have a tag like this: `````` and after I'm able to put my html code and finally the tag closes like this: ``````, can you try to put these tags? (this tag is after the Page tag) – Felipe Augusto Sep 02 '17 at 02:42
  • @Felipe Augusto I should be able to work in the Default.aspx file, right? Place the HTML elements inside of that. – User445555 Sep 02 '17 at 02:43
  • I think so! I removed the tags I told you and the same error appeared here, can you try to put these tags? – Felipe Augusto Sep 02 '17 at 02:45
  • @Felipe Augusto I going to edit my answer in a code snippet above with the Default.aspx file. Hold on! – User445555 Sep 02 '17 at 02:49
  • @Felipe Augusto I changed the Default.aspx code but I still get an error with the first html tag. Do you know why? – User445555 Sep 02 '17 at 02:56
  • Is the error exactly the same? – Felipe Augusto Sep 02 '17 at 02:58
  • @Felipe Augusto Yes, 'Element 'html' cannot be nested within element 'div'. I know what the error message means, but it doesn't make sense since I don't even have a 'div' element at the beginning. Do you know what I mean? – User445555 Sep 02 '17 at 03:00
  • Yes, the elements are inside the ```div``` because ```Default.aspx``` is called inside the ```Site.Master```. You can see that with a tag like this: ```
    ```on the ```Site.Master```, so you have to put only tags like ```
    ``` and other that are nested to a ```
    ```. Then start trying to put a simple ```
    ``` and try others.
    – Felipe Augusto Sep 02 '17 at 03:03
  • @Felipe Augusto I see what you mean about the
    tag in the SIte.Master file, but I don't see how that would help my problem since I already tried that and it still gave me an error.
    – User445555 Sep 02 '17 at 03:08
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/153507/discussion-between-felipe-augusto-and-user445555). – Felipe Augusto Sep 02 '17 at 03:09

1 Answers1

2

You can put HTML elements like this: <asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"> <div>Test</div> </asp:Content>.

If you want to edit the and others and things like that, you can make that inside the Site.Master.

But if you want to add other HTML pages you need to make new HTML page and add that inside the page you want(Maybe Default.aspx) , like this Stack answer.

Felipe Augusto
  • 7,733
  • 10
  • 39
  • 73