在這裏構建一個Web應用程序,我希望能夠替換我的監聽行。有人可以給我一些示例代碼來實現這一目標嗎? VS2010中的3個標準很糟糕,我希望能夠給它一些與我的webapp的方案一致的東西。第1行=藍色,2 =灰色,3 =藍色等等。C#WEb應用程序列表格式化
感謝
在這裏構建一個Web應用程序,我希望能夠替換我的監聽行。有人可以給我一些示例代碼來實現這一目標嗎? VS2010中的3個標準很糟糕,我希望能夠給它一些與我的webapp的方案一致的東西。第1行=藍色,2 =灰色,3 =藍色等等。C#WEb應用程序列表格式化
感謝
設置顏色在你的模板:
編輯補充 我想象中的標頭內置在LayoutTemplate模板,這樣你就可以大膽他們那裏(見我添加的代碼) 。您可能會想要使用CSS - 將單獨的CSS文件中需要的各種樣式定義爲類,並指定需要保存多餘類型的類。
<asp:ListView id="ListView1" runat="server">
<LayoutTemplate>
<table>
<tr>
<td style="font-weight:bold;">header</td>
<td style="font-weight:bold;">header</td>
</tr>
<asp:PlaceHolder id="itemPlaceHolder" runat="server" />
</table>
</LayoutTemplate>
<ItemTemplate>
<tr style="background-color:blue;">
<td></td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr style="background-color:gray;">
<td></td>
</tr>
</AlternatingItemTemplate>
</asp:ListView>
我簡化了代碼,但它應該讓你去你想要的地方。
這個http://stackoverflow.com/questions/4006071/alternate-color-in-listview-c-net-3-5/4006200#4006200可能是一個類似的情況,但我認爲這是WinForms。 – Amr
WinForm ListView(System.Windows.Forms.ListView)與System.Web.UI.WebControls.ListView不相似)。 – Tim