Try our conversational search powered by Generative AI!

Block actions - where to put them?

Vote:
 

Where is the 'correct' place to put actions for a block?

I've been playing around with having actions in the block controller. Problem is I don't seem to be able to post a form to the action directly because of the block not having its own url. Added a default route for {controller}/{action} but I don't think it's a great idea since the action doesn't get the currentPage data.

Another solution I was thinking about was to put the block actions in a base controller that all page controllers inherit from. That way all pages have the actions for all blocks. Not a good solution when having many blocks...

How is this normally solved?

#86932
Jun 04, 2014 15:12
Vote:
 

How about Web API and jquery combo?

#86935
Jun 04, 2014 15:34
Vote:
 

Of course that's one way of doing it, it won't add any advantages over adding a default controller/action route and use the block controller. I would still need to post one or more params to be able to lookup currentPage or currentBlock.

#86972
Jun 05, 2014 12:44
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.