We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
// I have a dictionary with a class (UserClass) asvalue and a int as key private Dictionary<int, UserClass> createdBy; //I populate the DropDownList with the dictionary using datasource CreatorFilter.DataSource = createdBy; CreatorFilter.DataTextField = "Value"; CreatorFilter.DataValueField = "Key"; CreatorFilter.DataBind(); //When the user selects an item from the CreatorFilter Dropdownlist I want to get the UserClass object back to get access to its ID property // Tried this: Guid UserID = (UserClass)CreatorFilter.SelectedItem).ID; // But I get an error: // Cannot convert type 'System.Web.UI.WebControls.ListItem' to 'UserClass' // How can I access the UserClass object from the selected item in the dropdownlost?
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.