adding one selectlistitem to another selectlistitem in c#

129 Views Asked by At

I have a two list where values get added from back end

List(SelectListItem) listItem = _db.tbl1(s => s.uc_name).Select(n =>
                                           new SelectListItem
                                           {
                                               Value = n.uc_id.ToString(),
                                               Text = n.uc_name
                                           }).ToList();

 List(SelectListItem) listitems1 = _db.tbl2.OrderBy(s => s.Description).Select(n =>
                                           new SelectListItem
                                           {
                                               Value = n.ID.ToString(),
                                               Text = n.Description
                                           }).ToList();

I want to insert listitems1 in listItem

listItem.Insert(listItem.Count,(SelectListItem)listitems1);

but it shows me error as

cannot convert from generic list to system.web.mvc.selectlistitem

0

There are 0 best solutions below