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 09:08:38
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01550250
Message ID:
01550281
Views:
42
>>
>>Sorry, I probably misread what you were binding the combobox to. The important point is that the ComboBox.SelectedItem property returns an Object and you should cast it to the actual type to access the members. If you are using v2 then you will need to change var to the actual type.
>>
>>If you're still stuck let me know the actual type of SelectedItem and I'll try again :-}
>
>Thank you for your reply. I suppose I need to upgrade to the latest version of VS since C# has some new features I could be using. But meanwhile I will use the actual type; this is not a problem.
>
>Since I use .NET very infrequently (even though I designed and wrote this program that I maintain), I am at loss to how cast the object to the actual type. If it does not take too much time for you to give me help, I would appreciate it. But if you are pressed by time, don't feel obligated. I will keep Googling on this question and hopefully will hit the right page.
>Again, thank you.

In my attempt:
var value = ((System.Data.DataRowView)ddlPriority.SelectedItem).Row["NUM_DAYS"];
I'm casting to the DataRowView type. Simply substitute your type within the brackets (and also use the type instead of var). Hopefully that will give you something to drill into to find what you need......

If you're thinking of upgrading then maybe you should wait for VS2012 / Net 4.5 which should be available soon (I'm using the RC)
,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform