I have a repeater that builds a dropdown menu. There is a field that places the URL in the value attribute. The field is nullable in the database, so for items that do not have a URL the value is empty. I need to replace that with something even if it is just ‘#’ so that the validation works.
Mark-Up
<ItemTemplate>
<option data-siteid="<%# DataBinder.Eval(Container.DataItem, "SiteID") %>" value="<%# DataBinder.Eval(Container.DataItem, "URL") %>">
<%# DataBinder.Eval(Container.DataItem, "Name") %>
</option>
</ItemTemplate>
Code Behind:
private void BindMakeList()
{
var makeList = this.repository.GetMakes();
rptDropDown.DataSource = makeList;
rptDropDown.DataBind();
}
How about: