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
VulpesPosted Mar 23, 2011, 12:57 PM
Mahesh ChandPosted Mar 24, 2011, 12:21 AM
Please do not use
Desi GalPosted Mar 23, 2011, 1:05 PM
Desi GalPosted Mar 23, 2011, 12:46 PM
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]);
}
VulpesPosted Mar 23, 2011, 12:39 PM
Desi GalPosted Mar 23, 2011, 12:30 PM
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[]
VulpesPosted Mar 23, 2011, 12:21 PM
Desi GalPosted Mar 23, 2011, 12:08 PM
VulpesPosted Mar 23, 2011, 11:59 AM