Click here to Skip to main content
15,885,203 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,


I have a page, where i have to implement update & delete. Since these two are two different actions, how can i implement in view BeginForm ?
Can anyone please help me out
Posted

Perhaps you can have the delete function getting invoked using AJAX. Have the delete action method as ChildActionOnly and make an ajax call to delete.
 
Share this answer
 
v2
Comments
Arjun Menon U.K 26-Dec-13 22:30pm    
Thanks Rahul : )
Rahul Rajat Singh 26-Dec-13 22:37pm    
You are most welcome. Always happy to help fellow developers.
May be you need two forms one for each action. Use two forms for each action e.g.

C#
//For Update
@(using Html.BeginForm("Method For Update", "Controller Name", FormMethod.Post))
{
}

//For Delete
@using(Html.BeginForm("Method For Delete", "Controller Name", FormMethod.Post))
{
}

if you need only one then for delete purpose use ajax as recomended by Rahul Rajat Singh.
 
Share this answer
 
v3
Comments
Arjun Menon U.K 26-Dec-13 22:29pm    
thanks hamad :)
Hammad 27-Dec-13 1:16am    
You're welcome Arjun...

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