CFanatic

Go Back   CFanatic > Programming > C# Programming

Join CFanatic Forum Now

Problem with Inserting an item to a list topic posted under C# Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 08-31-2010, 03:00 PM
 
Join Date: Aug 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
atuvy is on a distinguished road
| More
Problem with Inserting an item to a list

I am not sure if this is the appropriate forum for my question but I think it is more of a general c# problem than LINQ

I am running a LINQ query which populates a list used by a DropDownList, I need to insert an "Unassigned" value to the list. The function below queries the values correctly from the db but does not insert the "Unaasinged" value to the list. Please help.


Code:
public List GetTestList()
        {
            KeyValuePair item = new KeyValuePair(0, "Unassigned");

            using (DataClassesDataContext db = new DataClassesDataContext())
            {
                var Query = from records in db.TEST_SUITEs
                    orderby records.TEST_SUITE_ID
                    select new KeyValuePair
                    (
                        records.TEST_SUITE_ID, string.Format(records.TEST_SUITE_ID + " " + records.SUITE_TYPE + " " + records.SUITE_NAME)
                    );
                //Query.ToList().Insert(0, item);
                Query.ToList().Insert(0,item);
                return Query.ToList();
            }
        }
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Linked list () caraie C Programming 0 08-31-2010 04:00 AM
Inserting elements to vector Brejlounek C++ Programming 0 08-30-2010 04:51 AM
Drag Drop - detecting who sent item. taylby C# Programming 0 08-28-2010 03:11 AM
List problem ... need a second set of eyes.... Zinderin C# Programming 0 08-28-2010 03:11 AM
Menu item alignment Eri523 C++ Programming 0 08-28-2010 02:24 AM

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 03:59 PM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board