This is a noob question, but I will ask it anyway...
I'm wanting to create a page that will do basic CRUD operations on a list of items: -display the list -edit an item -create an item -delete an item
It is looking like I will need an action for each of this operations. This is good and understandable. My question is regarding the views for interacting with the user.
I want to have in-place editing, so the user clicks on edit and they can edit the details of the item in the list. In my current understanding, i will have to duplicate a great deal of the view between 'display the list' and 'edit an item'. however, this seems to be unnecessary redundancy and will make future updates more time-consuming as I will have to update each view.
Is there an easier way? Am I on the right/wrong track? Any other comments?
Yes, absolutely. You'll want to use the overload of View()
that takes a string. The string is the name of the view to render:
public ActionResult MyAction()
{
return View("MyViewName");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With