1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Problem with Inserting an item to a list

Discussion in 'C#' started by atuvy, Aug 31, 2010.

  1. atuvy

    atuvy New Member

    Aug 31, 2010
    Likes Received:
    Trophy Points:
    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.

    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);
                    return Query.ToList();

Share This Page