Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi i want to delete my row using entity frame work...But in DeleteObjet Method it shows some error...How can i rectify it...Anybody please help me...This is my code...


C#
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int customerID = Convert.ToInt32(((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text.Trim());
        ShivaEntities context = new ShivaEntities();
        //var delRecord = context.CustomerDBs.First(x => x.id == customerID);
        CustomerDB objdata = context.CustomerDBs.First(x => x.id == customerID);
        context.CustomerDBs.DeleteObjet(objdata);
        context.SaveChanges();
        BindData();
    }


Thanks in advance....
Posted
Updated 12-Feb-15 4:36am
v2
Comments
CHill60 12-Feb-15 11:48am    
"some error" is not helpful - what is the error?
Shivaram_i 13-Feb-15 0:29am    
System.Data.Entity.DbSet<customerdb> doesnot contain a definition for delete object and no extension method 'DeleteObject' accepting a first argument type
System.Data.Entity.DbSet<customerdb> could be found


This is my error

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