Reputation: 5013
I am working with an ASP repeater to get the elements from a Sitecore multi-list field (see code below). When the form is submitted, I can't pull the value of the selected option. Trying to add an ID and runat="server" to the element breaks the code because the repeater also has runat="server".
I'm very new to ASP, but it seems there has to be an option to pull the value of a selected field in a form.
This is the code:
<asp:Repeater ID="rptSubjectSelect" runat="server" OnItemDataBound="rptSubject_ItemDataBound">
<HeaderTemplate>
<select data-id="select" class="dropdown-component--select">
</HeaderTemplate>
<ItemTemplate>
<option value="<%# ((Sitecore.Data.Items.Item)Container.DataItem)["TextSubject"].ToString() %>"><%# ((Sitecore.Data.Items.Item)Container.DataItem)["TextSubject"].ToString() %></option>
</ItemTemplate>
<FooterTemplate>
</select>
</FooterTemplate>
</asp:Repeater>
Upvotes: 0
Views: 624
Reputation: 581
I'd recommend that instead of using a repeater this way (to manually build an HTML select input), use an ASP dropdown control.
Upvotes: 1