项目模板和布局模板之间有什么区别.在布局模板中,我们只有关于设计的信息?或其他任何事情.我无法理解项目模板..请解释..! 除了这个,我在项目中有这样的查询 SELECT TOP (1) ProductN
除了这个,我在项目中有这样的查询
SELECT TOP (1) ProductName, UnitPrice FROM Products ORDER BY NEWID()
这里NEWID()意味着什么?它是与sqlserver相关的预定义函数吗?我的项目中没有任何newid()函数被下载.如果它是预定义的功能那么它能做什么?
谢谢
ListView控件的主要布局是通过定义LayoutTemplate创建的. LayoutTemplate将包含用作数据的占位符的控件,如Table,Panel,Label或HTML控件,例如runat属性设置为“server”的table,div或span元素.项目模板是主模板,它将以重复的方式显示绑定到ListView的数据.此模板通常包含数据绑定到数据列或其他单个数据元素的控件.这两个模板是强制性的.
GroupTemplate将用于对项目进行分组. EditItemtemplate,SelectedItemTemplate,InsertItemTemplate显示在特定操作中,如insert,edit,select. ItemSeparatorTemplate,GroupSeparatorTemplate用于单独分隔各个项目和组项目.
这就是区别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>
参考链接:reference site,code project reference
