Click here to Skip to main content
15,905,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am developing a MVC 5 page in which i have to add/delete row dynamically.
I did it in java-script but i want to know is there anyway to do it in
MVC controller.

Thanks in advance
Posted
Comments
Sinisa Hajnal 4-Dec-14 2:25am    
There is and you shouldn't do it. Creating HTML string server side and injecting is essentially same as doing it via javascript (you create the elements and write into the documents). But js as the advantage of direct access to your DOM.

1 solution

Dear you anyhow need to do that in the Controller(Server Side), as using javascript the row gets deleted and persists until the page is refreshed. Once refreshed the row comes back again.
For that on click of delete you need to have an ajax call that would call the delete action method that would delete the row data from the database itself or have a boolean value and set that to "N".
I hope you understood.
Post back your queries if any.
Thanks.
 
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