Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET - what is the meaning of <%@ and <asp:Panel?

Tags:

asp.net

In the generated asp.net code from visual web developer 2010, I see the following code:

<%@ Control Language="C#" ClassName="Header" %>

    <asp:Panel ID="Panel1" runat="server">
        <img alt="xxx" 
            src="Images/bird.jpg" 
            width="800" height="110"/>
    </asp:Panel>
    <asp:Panel id="menuPanel" runat="server">
        <a href="1.aspx">Home</a> |
        <a href="2.aspx">Titles</a> |
        <a href="3.aspx">Authors</a> |
        <a href="4.aspx">Publishers</a>
    </asp:Panel>
  1. What is the meaning of <%@ in asp.net?
  2. What is the meaning of <asp:Panel?

I see other examples, <asp:Button <asp:Label, etc.

Thank you

like image 927
q0987 Avatar asked Feb 26 '23 06:02

q0987


1 Answers

ASP.NET server instructions are enclosed by angled brackets: <% ... %>; they tell ASP.NET to process their contents before sending a page to the client's browser.

@ identifies a directive, which do a variety of things but usually provide some instructions about what to do with the .aspx or .ascx file: Page and Control are two of the most commonly-used directives.

<asp:Panel> is an ASP.NET WebControl. Web controls are server-side representations of HTML elements. They allow you to manipulate the page in a code-behind file that's executed on the server before being delivered to the client's browser.

For example, ASP.NET renders Panel tags as <div> elements, and renders Button tags as <input> elements.

like image 125
Jeff Sternal Avatar answered Mar 11 '23 15:03

Jeff Sternal