我有一个
linq查询,填充Page_Load上的GridView.我为字母表做了一个循环的字符.在填充LinkButton的LinkButton的.Command中,我使用查询中相同的参数运行一个非常相似的查询,并得到以下错误.
The type ‘<>f__AnonymousType2’ exists in both ‘ConcernContracts.dll’ and ‘System.Web.WebPages.Deployment.dll’
void lnkCharacter_Command(object sender,CommandEventArgs e) { try { var lbtn = (LinkButton)lbl_Alphabet.FindControl("lnkCharacter" + e.CommandArgument); var id = lbtn.Text; using (var db = new dbDataContext()) { var query = from n in db.tbl_Providers where ((n.provider_Name.StartsWith(id)) && (n.provider_Deleted == false)) select new { n.ProviderId,n.provider_Name }; grd_Provider.DataSource = null; grd_Provider.DataSource = query; grd_Provider.DataBind(); } } catch (SystemException ex) { } }
LoadGrid()是一样的,但它不使用.StartsWith()条件.
你有什么想法如何解决错误?
该错误不会引发异常,但不会为任一查询填充网格.错误在以下行中被发现:grd_Provider.DataSource = query;