Castle.MonoRail.Framework.Helpers.FormHelper.Select C# (CSharp) Method

Select() public method

Creates a select element and its options based on the dataSource. If the dataSource elements are complex objects (ie not string or primitives), supply the parameters value and text to the dictionary to make the helper use the specified properties to extract the option value and content respectively.

You can also specify the attribute firstoption to force the first option be something like 'please select'. You can set the value of firstoption by specifying the attribute firstoptionvalue. The default value is '0'.

Usually the target is a single value and the dataSource is obviously a set with multiple items. The element types tend to be the same. If they are not, you might have to specify the suffix parameters on the attributes as it would not be inferred.

The target can also be a set. In this case the intersection will be the initially selected elements.

public Select ( string target, IEnumerable dataSource ) : string
target string The object to get the value from and to be based on to create the element name.
dataSource IEnumerable The set of available elements
return string
		public string Select(string target, IEnumerable dataSource)
		{
			return Select(target, dataSource, null);
		}

Same methods

FormHelper::Select ( string target, IEnumerable dataSource, IDictionary attributes ) : string
FormHelper::Select ( string target, object selectedValue, IEnumerable dataSource, IDictionary attributes ) : string