Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to find value in a column of data view
Message
From
10/08/2012 03:13:45
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01550250
Message ID:
01550258
Views:
50
>Hi,
>
>I have a data view of all records and all columns in a table. Then this data view is bound to a drop down control. Here is the segment of the code:
>
>
>dvPriority = BizObject.GetPriority();
>ddlPriority.DataSource = dvPriority;
>ddlPriority.DataValueField = "PRIORITY";
>ddlPriority.DataBind();
>
>
>When user selects a record from the drop-down list I can easily get the value of the bound column as
>
>this.ddlPriority.SelectedValue.ToString())
>
>
>But how can I get the value of some other column. For example, say this table has column "NUM_DAYS" (type Integer). How can I determine the value in this column based on the selected value? TIA.

Try:
var value = ((System.Data.DataRowView)ddlPriority.SelectedItem).Row["NUM_DAYS"];
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform