Control Parameters and DropDownList Text
- by Bunch
This is something that I rarely need to do, grab a DropDownList’s selected item’s text for use in a datasource’s ControlParameter. To allow for this use SelectedItem.Text instead of the more common SelectedValue for the PropertyName.
<asp:ControlParameter ControlID="ddlStuff" Name="stuffName" Type="String" PropertyName="SelectedItem.Text" />
The reason for using this is for text comparison. On rare occasions you may need to check the text against a list where the SelectedValue just does not help.
Technorati Tags: ASP.Net