Control Parameters and DropDownList Text

Posted by Bunch on Geeks with Blogs See other posts from Geeks with Blogs or by Bunch
Published on Fri, 18 Feb 2011 15:57:17 GMT Indexed on 2011/02/18 23:26 UTC
Read the original article Hit count: 197

Filed under:

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:

© Geeks with Blogs or respective owner