ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

SelectionValue

Returns Dropdownlist Selected Value as Integer

Source

public static int SelectionValue(this DropDownList ddl)
{
    var r = -1;
    int.TryParse(ddl.SelectedValue, out r);
    return r;
}

Example

var selectedValue = ddl.SelectedValue();

Author: Andi Haviari

Submitted on: 29 apr. 2016

Language: C#

Type: Integer

Views: 3591