I have dropdownlist
which has items that text and value property of the item are set to primary key. Yes, I show primary key with text property and querying with value property.
I want also to get selected item's other property such as name without querying dataset
that binds to dropdownlist
or querying database.
How can I do that?
<asp:DropDownList ID="ddl" runat="server">
<asp:ListItem Text="ItemID" Value="ItemID"></asp:ListItem> // I want get item's name
</asp:DropDownList>
If you want to get only one property such as name, you might want to do that
You can query with Text property which is primary key ItemID and get Value property which is ItemName with
DropDownList
Aspx Markup :Retrieve value like this :