renderaction

Error executing child request for handler in view

会有一股神秘感。 提交于 2019-12-28 13:41:07
问题 I have an MVC 4 view where I render the following actions @{ Html.RenderAction("Index", "Logo"); Html.RenderAction("Index", "MainMenu"); } I have a form on my view which is filled out and posted to the controller. In the controller I perform some tasks and then send the model back to my view [HttpPost] public ActionResult Index(ManageAdministratorModel manageAdministratorModel) { // I save some of the fields to the database here. return View(manageAdministratorModel); } When I'm redirected to

Error executing child request for handler in view

拜拜、爱过 提交于 2019-12-28 13:41:07
问题 I have an MVC 4 view where I render the following actions @{ Html.RenderAction("Index", "Logo"); Html.RenderAction("Index", "MainMenu"); } I have a form on my view which is filled out and posted to the controller. In the controller I perform some tasks and then send the model back to my view [HttpPost] public ActionResult Index(ManageAdministratorModel manageAdministratorModel) { // I save some of the fields to the database here. return View(manageAdministratorModel); } When I'm redirected to

Equivalent of Html.RenderAction in ASP.NET Core

泄露秘密 提交于 2019-12-18 14:12:45
问题 I am trying to switch to ASP.NET Core from my small ASP.NET MVC 4 application. In my MVC 4 application, I have a Layout file that uses RenderSection as: @RenderSection("xyz", required: false) Then, in my Index file, I have: @section xyz{ @{Html.RenderAction("abc");} } So, I am calling controller action method abc() from Index. The method abc() passes a model object and returns a partial view with that model. I cannot use RenderPartial as it needs a model to be passed. Now, in ASP.NET Core, I

Render action return View(); form problem

别说谁变了你拦得住时间么 提交于 2019-12-13 00:14:50
问题 I'm new to MVC, so please bear with me. :-) I've got a strongly typed "Story" View. This View (story) can have Comments. I've created two Views (not partials) for my Comments controller "ListStoryComments" and "CreateStoryComment", which do what their names imply. These Views are included in the Story View using RenderAction, e.g.: <!-- List comments --> <h2>All Comments</h2> <% Html.RenderAction("ListStoryComments", "Comments", new { id = Model.Story.Id }); %> <!-- Create new comment --> <%

How do I render an alternate child view in MVC?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 04:59:26
问题 I'm new to working with MVC so please don't assume I know anything. I am picking up a project that has much already written in MVC and I am trying to add some things to it. On one View there is a line <% Html.RenderAction("List", "Image", new { id = Model.JobId, all = true }); %> I see a List.ascx under the Image directory. I see the List method on the view controller. I'd like to render the results of that list method to a different ascx file. (AssignImage.ascx) I realize I could add another

The call is ambiguous between the following method or properties in ASP.NET MVC RenderAction

ぃ、小莉子 提交于 2019-12-11 02:35:07
问题 The call was working fine until I installed ASP.NET MVC 1.0 RTM. Error: CS0121: The call is ambiguous between the following methods or properties code snippet <%Html.RenderAction("ProductItemList", "Product"); %> Action Method public ActionResult ProductItemList() { return View("~/Views/Product/ProductItemList.ascx", _repository.GetProductList().ToList()); } 回答1: You have two action methods with the same signature, and the RenderAction cannot decide which to use. You need to somehow make the

RenderAction calls wrong action method

落爺英雄遲暮 提交于 2019-12-10 04:33:17
问题 I'm struggling with renderaction, the problem is that it calls the wrong action method on my controller. On my "Users" controller there are two action methods called edit, one for get and one for post requests: public virtual ActionResult Edit(int id) { //return a view for editing the user } [AcceptVerbs(HttpVerbs.Post)] public virtual ActionResult Edit(UserViewModel model) { //modify the user... } In my view, I'm calling Renderaction it as follows: Html.RenderAction("Edit", "Users", new { id

refreshing html.renderaction with ajax request

时间秒杀一切 提交于 2019-12-07 06:53:39
问题 I have div that renders image gallery on my page <div id="gallery"> @{ Html.RenderAction("UserGallery"); } I have this function which runs on the completion of a successful upload of a new image function filesUploadOnSuccess(e) { function updateCart() { //var tdata = $(frm).serialize(); // or your data in the format that will be used ?? $.ajax({ type: "GET", //data: tdata, url : '@Url.Action("UserGallery")', dataType: "json", success: function (result) { success(result); } }); }; } function

Like Html.RenderAction() but without reinstantiating the controller object

孤街醉人 提交于 2019-12-07 02:00:55
问题 I like to use the RenderAction extension method on the HtmlHelper object to render sidebars and the like in pages, as it allows me to keep the data access code for each such part in separate methods on the controller. Using an abstract controller base, I can define a default "sidebar strategy", which can then be refined by overriding the method in a concrete controller, when needed. The only "problem" I have with this approach, is that the RenderAction is built in a way where it always

RenderAction calls wrong action method

社会主义新天地 提交于 2019-12-05 08:09:47
I'm struggling with renderaction, the problem is that it calls the wrong action method on my controller. On my "Users" controller there are two action methods called edit, one for get and one for post requests: public virtual ActionResult Edit(int id) { //return a view for editing the user } [AcceptVerbs(HttpVerbs.Post)] public virtual ActionResult Edit(UserViewModel model) { //modify the user... } In my view, I'm calling Renderaction it as follows: Html.RenderAction("Edit", "Users", new { id = 666}); Now the problem is that I want the GET action method to be rendered. However (perhaps because