I have two lists:
List< object > totalkeys = GridView.GetCurrentPageRowValues("StudentId", "CourseId");
List< object > selectedkeys = GridView.GetSelectedFieldValues("StudentId", "CourseId");
I have two lists one with the total keys and the other list with selected keys.
I want to have a third list with unselected keys.
So I am trying to use this piece of code without any success.
List < object > unselectedkeys = totalkeys.Except(selectedkeys);
Am I missing anything?
Any other suggestions ?
Thanks
Loading

VulpesRank #55 · 29.2K reputationPosted Mar 23, 2011, 8:57 AM EDT
VulpesRank #55 · 29.2K reputationPosted Mar 23, 2011, 7:59 AM EDT
Desi Gal35 reputationPosted Mar 23, 2011, 8:08 AM EDT
VulpesRank #55 · 29.2K reputationPosted Mar 23, 2011, 8:21 AM EDT
To get an idea of the format, what does totalkeys[0].ToString() and selectedkeys[0].ToString() return?
Desi Gal35 reputationPosted Mar 23, 2011, 8:30 AM EDT
I don't care about the form, I'm just trying to get all the unselected values.
string test=totalkeys[0].ToString();
The return value for the above line is System.Object[]
VulpesRank #55 · 29.2K reputationPosted Mar 23, 2011, 8:39 AM EDT
Desi Gal35 reputationPosted Mar 23, 2011, 8:46 AM EDT
cannot apply indexing to an expression of type object
but i can extract the values using
foreach (object key in totalkeys)
{
int StudentId= Convert.ToInt32(((object[])(key))[0]);
int CourseId= Convert.ToInt32(((object[])(key))[1]);
}
Desi Gal35 reputationPosted Mar 23, 2011, 9:05 AM EDT
Mahesh ChandRank #1 · 393.3K reputationPosted Mar 23, 2011, 8:21 PM EDT
Please do not use
Thanks!