Click here to Skip to main content
15,879,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have page like this e.g.
Student Name: textbox

Subjects Marks

C++ [checkbox] textbox
Java [checkbox] textbox


if i come on this page for edit then if i select two checkbox then existing record say C++ record should get updated and Java record is not in Database then it should get added in db..
i tried but i can only able to get edited but the new record is not added...
Can anyone help plz??
Updated 1-Mar-14 1:39am

1 solution

You should provide more info (source code from your controller for example), but supposing you are using Entity Framework and your tables (and EF classes) have IDs, the ideea is that in the conttroller you have to test the data that that come form the view by its ID, if the ID is 0 means new data and you should manage this case by adding the new record in the associated "Subject Marks" EF entity by using "AddObject()" method, then at the end to use "SaveChanges()".
Share this answer

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