我正在嘗試使奇數float:left
和偶數float:right
。然而,無論列表中有多少項目,顯然每個項目都是奇數AND元素1。我如何在CSS中訪問它。顯然,由於每個項目是1
,那麼:nth-child(odd) {float:left;}
和:nth-child(even){float:right;}
不起作用。你還可以訪問他們嗎?訪問ASP ListView中的每個項目
這將是結構類似這樣:
<div class="options">
<asp:ListView ID="ListView1" runat="server"
DataSourceID="OptionsObjectDataSource"
EditIndex="-1"
OnPreRender="FabricsListView_PreRender">
<ItemTemplate>
<asp:DropDownList ID="OptionsAltDropDownList" runat="server" style="width:100%"
DataSourceID="OptionsObjectDataSource"
DataTextField="description"
DataValueField="id"
AppendDataBoundItems="true"
OnDataBound="OptionsAltDropDownList_DataBound" >
<asp:ListItem Value="">- Select Alt Option -</asp:ListItem>
</asp:DropDownList>
<asp:ObjectDataSource ID="OptionsObjectDataSource"
runat="server"
SelectMethod="GetOptionList"
TypeName="Data.ProductList" >
</asp:ObjectDataSource>
</ItemTemplate>
</asp:ListView>
<asp:ObjectDataSource ID="OtherObjectDataSource" runat="server"
SelectMethod="GetByProduct"
TypeName="Data.RequirementList"
OldValuesParameterFormatString="original_{0}">
<SelectParameters>
<asp:ControlParameter ControlID="OptionHiddenField" Name="id" PropertyName="Value" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
</div>