asp.net - how to split the string in LINQ? -


i have bind search results in grid view based on search criteria. in database primary store id value 10,12. when select particular primary store id dropdown list i.e. 10, search result corresponding primary store id need shown in grid view.how that?

public static list<searchkeyword> getallkeywords(string key,           string primarystoreid, string keywordstatus, int keywordid,          string categoryname, string subcategoryname) {      keys = db.searchkeywords.where(c => c.keyword.contains(key) &&      (c.primarystoreid == primarystoreid ||      c.primarystoreid.split(',').tolist().contains(primarystoreid)) &&      (string.isnullorempty(categoryname) || c.storecategorymapping == categoryname) &&      (string.isnullorempty(subcategoryname) || c.storesubcategorymapping ==      subcategoryname)).tolist(); } 

edited!

assumption -- search db.searchkeywords elements in attribute primarystoreid (a comma separated list) contains key.

public static list<searchkeyword> getallkeywords(string key,           string primarystoreid, string keywordstatus, int keywordid,          string categoryname, string subcategoryname) {      return db.searchkeywords       .where(c => c.primarystoreid.split(",".tochararray()).contains(key)); } 

not clear @ want other parameters.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -