controller

Asp.net MVC ReturnUrl variable not showing up with method FormMethod.Post in Html.BeginForm

荒凉一梦 提交于 2019-12-24 06:35:29
问题 The default template in MVC3 sets a 'returnurl' variable in the query string of the logon page. This page then posts back to a controller @using (Html.BeginForm()) { That is then picked up in the controller like so [HttpPost] public ActionResult LogOn(LogOnModel model, string returnUrl) { I wanted to add a CSS class to the form so I changed the helper to: @using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { @class = "form-horizontal" })) But now information in the query string

Codeigniter - passing multiple values to view

流过昼夜 提交于 2019-12-24 04:01:30
问题 Okay, so generally I wouldn't have a problem doing this and it would be fairly straight forward, but not so much this time. Here is the relevant code in my controller: // In order to properly build the form url, we need to include the // category and product to the view $this->data = array( 'category' => $category, 'product' => $product ); // Load the product model and get editable values from the database $this->load->model('productadmin/products_model'); $productInformation = $this-

ASP.Net MVC3 Model Binding IEnumerable<T> with Editor Template [duplicate]

只谈情不闲聊 提交于 2019-12-24 03:51:38
问题 This question already has an answer here : How to pass IEnumerable list to controller in MVC including checkbox state? (1 answer) Closed 3 years ago . All, please clear up my confusion on how the model binding works with IEnumerables and Editor Templates. I have a view, Approve.cshtml @model IEnumerable<MvcWebsite.Models.Approve> <table> <tr> <th> Name </th> </tr> @Html.EditorForModel() </table> A model, Approve.cs public class Approve { public string Name { get;set;} public string Role { get

ASP.Net MVC3 Model Binding IEnumerable<T> with Editor Template [duplicate]

倖福魔咒の 提交于 2019-12-24 03:51:08
问题 This question already has an answer here : How to pass IEnumerable list to controller in MVC including checkbox state? (1 answer) Closed 3 years ago . All, please clear up my confusion on how the model binding works with IEnumerables and Editor Templates. I have a view, Approve.cshtml @model IEnumerable<MvcWebsite.Models.Approve> <table> <tr> <th> Name </th> </tr> @Html.EditorForModel() </table> A model, Approve.cs public class Approve { public string Name { get;set;} public string Role { get

Passing values to view in Zend Framework 2

六眼飞鱼酱① 提交于 2019-12-24 03:27:23
问题 I'm trying to convert our existing application from Zend Framework 1 to Zend Framework 2 and I'm having a little trouble. In the original application I had the following in my controllers function init() { $this->initialize_values(); } All my controllers extended a base class which had that function in it as seen here. protected function initialize_values() { $this->_db = Zend_Registry::get('dbAdapter'); $this->_current_user = new User(&$this->_db); $this->_auth = Zend_Auth::getInstance(); if

Calling a controller from another

落花浮王杯 提交于 2019-12-24 03:12:18
问题 I want to call an action of a controller from another controller. How can I do this? Some years ago, there were compononents, but they are not available any more. Best regards 回答1: You can't call an other controller's action method. You have only two solutions. Doing a redirect to the appropriate URL. redirect_to '/' But of course if you have datas from a form, you lose them. Render the action from an other controller. render 'controller/action' You keep all your defined datas (params and

Calling a controller from another

依然范特西╮ 提交于 2019-12-24 03:12:13
问题 I want to call an action of a controller from another controller. How can I do this? Some years ago, there were compononents, but they are not available any more. Best regards 回答1: You can't call an other controller's action method. You have only two solutions. Doing a redirect to the appropriate URL. redirect_to '/' But of course if you have datas from a form, you lose them. Render the action from an other controller. render 'controller/action' You keep all your defined datas (params and

Symfony2 and MVC - Is extend controller a good practice?

杀马特。学长 韩版系。学妹 提交于 2019-12-24 02:09:27
问题 I have a simple and perhaps stupid question. Using Symfony2 PHP framework i often work extending controllers like below ( of course it depends from the kind of work ): class MainController extends Controller{ private $locale = array(); protected function Locale() { $em = $this->getDoctrine() ->getManager(); $this->locale = $em->getRepository('CommonLanguageBundle:Language') ->findBy( array('code' => $this->getRequest() ->getLocale() ) ); // \Doctrine\Common\Util\Debug::dump($this->locale);

Ruby on Rails two create actions to two different controllers simultaneously

旧巷老猫 提交于 2019-12-24 01:18:58
问题 I have a Threads controller and Messages controller. Threads has_many Messages Once a user clicks send, I send data into Threads controller to create the thread. I want to make it to so that threads_controller.rb def create ... if @thread.save #send data into messages_controller #to create the corresponding table for a message with this thread_id end So, essentially I am trying to do two POSTS one after another if the first one succeeds. I think redirect_to is what I am supposed to use. Is it

Custom RepositoryRestController Mapping url throws 404 in spring-data-rest

拟墨画扇 提交于 2019-12-24 01:15:34
问题 I have written a custom RepositoryRestController using its corresponding entity repository. When performing request on this url, the query is running in my console, but the url returns 404. I also able to see the requestHandlerMapping for this url in logs. Refer my following code snippet. Repository: @RepositoryRestResource public interface FooRepository extends BaseRepository<Foo, Integer> { @RestResource(exported = false) List<Foo> findByName(String name); } Controller: