The difference between a template and a layout template

What is the difference between an element template and a layout template. in the layout template only do we have design information? or something else. I can not understand the element template. Explain, please..!

In addition to this, I have a request in a project like this

SELECT TOP (1) ProductName, UnitPrice FROM Products ORDER BY NEWID()

here NEWID () means what? is this a predefined function related to sqlserver? in my project there is no newid () function that was loaded. if it is a predefined function, then what can it do?

thank

+3
source share
2 answers

ListView LayoutTemplate. LayoutTemplate , , , , HTML, , div span, runat, "server". - , , ListView, . , . .

GroupTemplate . EditItemtemplate, SelectedItemTemplate, InsertItemTemplate , , , , . ItemSeparatorTemplate, GroupSeparatorTemplate .

Structure of listview

ItemPlaceholderID="itemPlaceholder"

<asp:ListView runat="server" ID="ListView1" ItemPlaceholderID="itemPlaceholder">
<LayoutTemplate>
     <table border="0" cellpadding="1">
      <tr style="background-color:#E5E5FE">
       <th align="left"><asp:LinkButton ID="lnkId" runat="server">Id</asp:LinkButton></th>
       <th align="left"><asp:LinkButton ID="lnkName" runat="server">Name</asp:LinkButton></th>
       <th align="left"><asp:LinkButton ID="lnkType" runat="server">Type</asp:LinkButton></th>
       <th></th>
      </tr>
      <tr id="itemPlaceholder" runat="server"></tr>
     </table>
    </LayoutTemplate>
    <ItemTemplate>
      <tr>
       <td><asp:Label runat="server" ID="lblId"><%#Eval("ID") %></asp:Label></td>
       <td><asp:Label runat="server" ID="lblName"><%#Eval("FirstName")+" 
        "+Eval("LastName") %></asp:Label></td>
       <td><asp:Label runat="server" ID="lblType"><%#Eval("Type") %></asp:Label></td>
       <td></td>
      </tr>
    </ItemTemplate>
    <AlternatingItemTemplate>
      <tr style="background-color:#EFEFEF">
       <td><asp:Label runat="server" ID="lblId"><%#Eval("ID") %></asp:Label></td>
       <td><asp:Label runat="server" ID="lblName"><%#Eval("FirstName")+" "+
        Eval("LastName") %></asp:Label></td>
       <td><asp:Label runat="server" ID="lblType"><%#Eval("Type") %></asp:Label></td>
       <td></td>
      </tr>
    </AlternatingItemTemplate>
</asp:ListView>

: ,

+7

, ListView.

ItemTemplate , . LayoutTempate .

, . LayoutTemplate "itemPlaceHolder"

<tr id="itemPlaceHolder" runat="server" />

s.

0

Source: https://habr.com/ru/post/1791171/


All Articles