开发者

getting error in RadGrid Control while manually doing update?

code 1:

protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e开发者_运维知识库)
        {
            GridEditableItem item = e.Item as GridEditableItem;
            var roll = item.GetDataKeyValue("rollno").ToString();
            //int t = Int32.Parse(roll);
            students stdd = DbContext.students.Where(p => p.rollno == roll).FirstOrDefault();
            item.UpdateValues(stdd);
            DbContext.SaveChanges();

        }

This is my code in RadGrid to update the DB,i'm getting error at "(p => p.rollno == roll)",that is "Delegate System.Func Does not take 1 argument".

and i'm using EntityDataModel.In my DB table name is student and 'rollno' is identity.


Similar problem is described here: linq-to-sql delegate does not take "1" argument. See post by RiskSWDeveloper_WorkEmail.

RiskSWDeveloper_WorkEmail post:

Replying for others who may encounter the original issue, "Delegate 'System.Func does not take '1' arguments':

I recently encountered this issue with Linq to Entities after I had changed a fieldname in my underlying table and refreshed my entity model. The linq query I had selecting from my ObjectContext still used the old fieldname in the query (i.e. .Where(x => x.OldFieldname == "MyValue"). I got the above error ('Delegate ',int,bool> does not take '1' arguments' until I fixed the fieldname.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜