У меня есть элемент управления Listview, который содержит элементы управления выпадающим списком внутри его InsertItemTemplate и ItemTemplate. Как заполнить эти элементы управления списком вниз? Это моя разметка.Как заполнить DropDownList внутри asp.net Элемент управления ListView
<asp:ListView ID="ListView1" runat="server" SelectedIndex="0"
InsertItemPosition="LastItem" onitemcommand="ListView3_ItemCommand">
<LayoutTemplate>
<table border="0" cellpadding="1" width="100%" class="formtab">
<tr class="header" >
<th align="left" width="145px" >Sub Project</th>
<th align="left" width="145px">Alloc</th>
<th align="left" width="90px">AMT</th>
<td align="center" width="30px"></td>
</tr>
<tr id="itemPlaceholder" runat="server" style="height:30px;border:1px solid gray;"></tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr class="item" runat="server" id = "thisRow" >
<td align="left" >
<asp:DropDownList ID="List2QuoteSubProject" Text='<%# Eval("SubProjectID") %>' runat="server" Width="140px">
</asp:DropDownList>
</td>
<td align="left">
<asp:HiddenField ID="HiddenField2" Value='<%# Eval("VendorQuoteAllocationID") %>' runat="server" />
<asp:DropDownList ID="List2QuoteAllocation" Text='<%# Eval("AllocationID") %>' runat="server" Width="140px">
</asp:DropDownList>
</td>
<td align="left">
<asp:TextBox ID="List2Amount" runat="server" Text='<%# Eval("Amount") %>' Width="85px">
</asp:TextBox>
</td>
<td align="center" >
<asp:ImageButton ID="ImageButton1" runat="server" style="margin-left:8px;margin-right:8px;" ImageUrl="~/Images/icons/remove.png" Width="16" Height="16" />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
Это событие выполняется после того, как данные привязаны. Итак, если я установил текст в раскрывающийся список при привязке, он будет вызывать ошибку, поскольку dropdownlist еще не заселен. –
Где вы заполняете раскрывающийся список? –
внутри ListView1_ItemDataBound. Я хочу, чтобы выпадающий список привязывался к каждой строке –