c# - where clause in LINQ to Entites DataBind -
i'm trying add clause existing linq databind nothing works. clause want add checks if in table refauthsigner column isactive == 1.
here's existing query:
// populates authorized signer dropdownlist using (dbpsrentities10 myentities = new dbpsrentities10()) { var allsigners = refauthsigner in myentities.refauthsigners <--- clause somewhere around here?? select new { refauthsignerid = refauthsigner.refauthsignerid, refauthsignername = refauthsigner.refauthsignerfirst + " " + refauthsigner.refauthsignerlast }; ddlauthsigners.datasource = allsigners; ddlauthsigners.datavaluefield = "refauthsignerid"; ddlauthsigners.datatextfield = "refauthsignername"; ddlauthsigners.databind(); }
i want add clause like:
var allsigners = refauthsigner in myentities.refauthsigners refauthsigner.isactive == 1
this code isn't right , wondering how incorporate clause code. thanks!
try this:
var allsigners = refauthsigner in myentities.refauthsigners refauthsigner.isactive select new { refauthsignerid = refauthsigner.refauthsignerid, refauthsignername = refauthsigner.refauthsignerfirst + " " + refauthsigner.refauthsignerlast };
Comments
Post a Comment