Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to populate dropdownlistFor in mvc asp.net . primary key is GUID .
C#
var result2 = db.Divisions.Select(f => new SelectListItem
{
    Value = f.DivisionID.ToString(),
    Text = f.DivisionName
});

ViewBag.SectionList =result1;

Facing issue in ToSring()

LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.

Please suggest me some solution of this issue. Thanks in advance
Posted
Updated 30-Jan-14 20:21pm
v2

1 solution

Try this
C#
Value =  System.Data.Objects.SqlClient.SqlFunctions.StringConvert.StringConvert(f.DivisionID)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900