I'm trying to display some data within a select using the following code:
<select name="area" runat="server">
<asp:Repeater ID="RepeaterArea" runat="server">
<ItemTemplate>
<option value="<%# Eval('Id') %>" runat="server"><%# Eval("Area") %></option>
</ItemTemplate>
</asp:Repeater>
</select>
I get an error stating that I cannot have a repeater inside a HTMLSelect.
Any suggestions would be very welcome, thanks!
Why is your
<select>
being run at the server? Remove that attribute and it should compile fine.As the error says, the only valid child element of an
HtmlSelect
are options or optgroup thingy, not asp repeaters (even if they do create options, the compiler isn't aware of this).Remove the
runat="server"
. You can get the value byRequest.Form["area"].ToString()
Try removing the runat="server" from select tag