I have a Combobox that uses a itemtemplate that is bound to a class object and OnSelectedIndexChanged I need to get the dataitem of that item to get the class object but cant seem to get this to work. Any suggestions?
//How do I get the dataitem of the selected index??
1 Answer, 1 is accepted
answered on 25 Oct 2017, 08:30 AM
The DataItems of the individual items is available only during the ItemDataBound event handler. You can use place a asp:Label control inside the ItemTemplate and set the Eval expression to its Text property. Then, you can use the cmbOptions.SelectedItem.FindControl("LabelID") to access the label instance and consequently its Text value.