<asp:ListView ID="ListView1" runat="server" GroupItemCount="5">
<LayoutTemplate>
<table runat="server" id="table1">
<tr runat="server" id="groupPlaceholder">
</tr>
</table>
</LayoutTemplate>
<GroupTemplate>
<tr runat="server" id="tableRow">
<td runat="server" id="itemPlaceholder" />
</tr>
</GroupTemplate>
<ItemTemplate>
<td id="Td1" runat="server">
<%-- Data-bound content. --%>
<asp:Label ID="NameLabel" runat="server" Text='<%#Eval("yyyy") %>' />
</td>
<td id="Td2" runat="server">
<%-- Data-bound content. --%>
<asp:Label ID="NameLabel" runat="server" Text='<%#Eval("nnnn") %>' />
</td>
</ItemTemplate>
</asp:ListView>
var by1 = from x in model.x
xxxx
select new
{
x.yyyy
};
ListView1.DataSource = by1;
ListView1.DataBind();
var by2 = from z in model.z
zzzz
select new
{
z.nnnn
};
ListView1.DataSource = by2;
ListView1.DataBind();
這是一個樣本(不需要寫入工作真的是這樣) 我不知道我怎樣才能在一個列表不同勢性能得到2個不同勢querys。 like:如何顯示從linq到Listview的2個查詢結果?
zzzzz:1111
zzzzz:2222
nnnn:ffff
nnnn:gggg
zzzz:3333
謝謝。
也許我需要使用2個用戶控件,並把它們放到面板?這種方式我想給我使用不同的屬性和控制 – Liroy 2011-05-17 23:15:06
你想要列出每個列表的屬性是相同的數據類型? – ashelvey 2011-05-17 23:40:58
Linq有一個聯合方法。嘗試使用by1和by2代替相同的數據源和綁定。 – Jeremy 2011-05-18 01:56:18