joeharrison714 / MVCGrid.Net

http://mvcgrid.net
MIT License
74 stars 55 forks source link

Client Side Data Annotations are stopping a selected drop down Item from being displayed when the page loads #38

Open jeffrfinn opened 8 years ago

jeffrfinn commented 8 years ago

I have the following dropdown for a filter @Html.DropDownListFor(model => Model.AreaId, Model.AreaItems, new { @class = "form-control", @id = "areaDropDown", data_mvcgrid_type = "filter", data_mvcgrid_option = "Area" })

This creates the following HTML

<select class="form-control" data-mvcgrid-option="Area" data-mvcgrid-type="filter" data-val="true" data-val-number="The field Area must be a number." data-val-required="The Area field is required." id="areaDropDown" name="AreaId">
<option selected="selected" value="0">--ALL--</option>
</select>

Notice that there is only one option.

I tried to load a screen shot but it didn't work. Let me try an explain what is happening. When the page First loads the drop down box is empty and I only see --ALL-- when I select the drop down Item. I don't know why it appears as if there is an option when it isn't in the HTML

I can see the same issue on the filtering demo http://mvcgrid.net/demo/filtering

What I am expecting to See is that --ALL-- is in selected in the drop down box when the page loads first.