I have a simple wizard generated query in a LinqDataSource like this:
<asp:LinqDataSource ID="EvaluationsData" runat="server" ContextTypeName="Bonus.Models.BonusDataContext"
Select="new (Id, Name, Coverage)" TableName="BM_Evaluations"
</asp:LinqDataSource>
I assign this data source to a DropDownList, using Id and Name as the DataValueField and DataTextField respectively. But when I selected a option, I want to keep the Coverage too, extracting it from the data source and storage in a HiddenField. It’s a way to do this without making another query to the database?
Thanks.
To do this, you’ll need to intercept the returned list of items from the data source and then manually assign Coverage to the items in the drop-down’s items.
Here’s your markup
Here’s your code