Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

[HTML helpers] Do not set Selected in user's SelectListItem instances #524

Closed
dougbu opened this issue May 12, 2014 · 1 comment
Closed
Assignees
Milestone

Comments

@dougbu
Copy link
Member

dougbu commented May 12, 2014

DropDownList(), DropDownListFor(), ListBox(), and ListBoxFor() all update the Selected property of the entries in the IEnumerable<SelectListItem> passed or found in ViewData. These updates handle round-tripping updated values submitted in a form. However use of the passed SelectListItem instances pollutes the user's objects and makes it difficult to share select lists between different properties in the model.

Fortunately not sharing select lists is a viable workaround. Also conflicts are only visible if one call updates the select list and another one just reads the enumerable (because the value is null).

See legacy CodePlex bug #1913 for more information.

@JaneZhouQ JaneZhouQ added this to the Post Alpha milestone May 13, 2014
@kanchanm kanchanm modified the milestones: Alpha, Post Alpha May 14, 2014
@dougbu dougbu added the bug label May 30, 2014
@danroth27 danroth27 added this to the 6.0.0-rc1 milestone Oct 15, 2014
@danroth27 danroth27 modified the milestones: 6.0.0-beta3, 6.0.0-rc1 Jan 15, 2015
dougbu added a commit that referenced this issue Feb 11, 2015
- #524
- add tests of `DropDownList` and `ListBox` HTML helpers
- extend tests of `<select/>` tag helper
- add scenario to a functional test

New `HtmlHelperSelectTest` does not cover everything. In future (see #453):
- use non-`null` `optionLabel` and `htmlAttributes` arguments
- confirm value sources and their priorities
- mock an `IHtmlGenerator` and confirm how it is called
- mock an `IHtmlHelper` and confirm how extension methods call that
dougbu added a commit that referenced this issue Feb 12, 2015
- #524
- add tests of `DropDownList` and `ListBox` HTML helpers
- extend tests of `<select/>` tag helper
- add scenario to a functional test

New `HtmlHelperSelectTest` does not cover everything. In future (see #453):
- use non-`null` `optionLabel` and `htmlAttributes` arguments
- confirm value sources and their priorities
- mock an `IHtmlGenerator` and confirm how it is called
- mock an `IHtmlHelper` and confirm how extension methods call that
dougbu added a commit that referenced this issue Feb 12, 2015
- #524
- add tests of `DropDownList` and `ListBox` HTML helpers
- extend tests of `<select/>` tag helper
- add scenario to a functional test

New `HtmlHelperSelectTest` does not cover everything. In future (see #453):
- use non-`null` `optionLabel` and `htmlAttributes` arguments
- confirm value sources and their priorities
- mock an `IHtmlGenerator` and confirm how it is called
- mock an `IHtmlHelper` and confirm how extension methods call that
dougbu added a commit that referenced this issue Feb 13, 2015
- #524
- add tests of `DropDownList` and `ListBox` HTML helpers
- extend tests of `<select/>` tag helper
- add scenario to a functional test

New `HtmlHelperSelectTest` does not cover everything. In future (see #453):
- use non-`null` `optionLabel` and `htmlAttributes` arguments
- confirm value sources and their priorities
- mock an `IHtmlGenerator` and confirm how it is called
- mock an `IHtmlHelper` and confirm how extension methods call that
@dougbu
Copy link
Member Author

dougbu commented Feb 13, 2015

Fixed w/ commit 3ced601

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants