partial-views

ASP.NET MVC3 ajax partial view refresh

痞子三分冷 提交于 2019-12-22 17:36:08
问题 I am facing a problem with ajax updating of div in asp.net mvc3. I have a View with content <div id="post_comments"> @{Html.RenderPartial("_RefreshComments", Model);} </div> <div id="commentForm"> @using (Ajax.BeginForm("Details", new { id = Model.Post.PostId }, new AjaxOptions { HttpMethod = "POST", InsertionMode = InsertionMode.InsertAfter, UpdateTargetId = "post_comments" } )) { // form content goes here <p id="buttons"> <input type="submit" value="@Strings.Save" /> </p> } This is my

How to dynamically display a list of both name and value of a String/boolean pair on MVC in ASP.NET MVC

风流意气都作罢 提交于 2019-12-22 12:15:42
问题 I need to dynamically display a list of both name and value of string/boolean pair on MVC view (*.cshtml) based on user selection. Specifically, both name and value of a string and boolean pair are different in each list. There are more one list that user can select. For example: FruitName: Apple (string:string) IsRipen: true (string:boolean) BookName: C# IsSold: false One list type is defined as one report type. A list can be retrieved from report programmatically. Possible Solution 1 Since

ASP.NET MVC3 Upload a file from a Partial view (and fill the corresponding field in the Model)

天涯浪子 提交于 2019-12-22 10:54:57
问题 I know the subject has already been discussed on SO and elsewhere, but I can't find any answer to my question. I'm working on an ASP.NET MVC3 project, and I'd like to create a Partial view containing a FileUpload . This partial view is called on a basic Create page, and I'd like the file to upload belongs to the model to create. It is only when the user will submit the form the selected file will be uploaded. Here is an explanation by the code : Model ModelToCreate public class ModelToCreate

Why is a value that I update in my model inside an MVC3 controller not rendered on the client?

橙三吉。 提交于 2019-12-22 07:46:57
问题 I have a controller action UpdateCustomer(CustomerDto customer) that returns a PartialViewResult with a model that is also a CustomerDto : [HttpPost] public PartialViewResult UpdateCustomer(CustomerDto customer) { CustomerDto updatedCustomer = _customerService.UpdateCustomer(customer); updatedCustomer.Name = "NotThePostedName"; return PartialView("CustomerData", updatedCustomer); } In my view, I have the following line: @Html.TextBoxFor(model => model.Name) So far, so good. In my view I do an

Why is a value that I update in my model inside an MVC3 controller not rendered on the client?

对着背影说爱祢 提交于 2019-12-22 07:46:29
问题 I have a controller action UpdateCustomer(CustomerDto customer) that returns a PartialViewResult with a model that is also a CustomerDto : [HttpPost] public PartialViewResult UpdateCustomer(CustomerDto customer) { CustomerDto updatedCustomer = _customerService.UpdateCustomer(customer); updatedCustomer.Name = "NotThePostedName"; return PartialView("CustomerData", updatedCustomer); } In my view, I have the following line: @Html.TextBoxFor(model => model.Name) So far, so good. In my view I do an

mvc partial view post

给你一囗甜甜゛ 提交于 2019-12-22 06:36:12
问题 I have a company object which has a list of branch objects, my company view(residing in the company directory) has a strongly typed branch list view (residing in the branch directory)in it, each branch in the branch view has a delete button which I want to post to a delete action in the branch controller. at present the invoked delete action is the one in the company controller (there is a delete action in both company and branch) I believe I understand the reason it is doing what it is,

ASP .NET MVC correct UserControl architecture

时光总嘲笑我的痴心妄想 提交于 2019-12-22 06:03:42
问题 I'm trying to learn the new ASP .NET MVC framework and would like to know the best practice for using UserControls. I understand that you can render UserControl's as a partial and pass data to them from a controller. Ideally I would think that it makes sense not to have a code behind file as this creates a temptation to break the MVC rules. I'll give an example where I don't understand how UserControls fit into the pattern. I have a UserControl that shows the latest tags (much like on

ASP .NET MVC correct UserControl architecture

妖精的绣舞 提交于 2019-12-22 06:01:12
问题 I'm trying to learn the new ASP .NET MVC framework and would like to know the best practice for using UserControls. I understand that you can render UserControl's as a partial and pass data to them from a controller. Ideally I would think that it makes sense not to have a code behind file as this creates a temptation to break the MVC rules. I'll give an example where I don't understand how UserControls fit into the pattern. I have a UserControl that shows the latest tags (much like on

ASP.Net MVC 3 RC2, Partial Views Form Handling

痞子三分冷 提交于 2019-12-21 23:10:09
问题 After years of Web Forms development I've decided to give MVC a go. I've been able to work through most of the other stumbling blocks, but I'm kind of stuck on this one. In Web Forms I would create controls for each of my forms in order to modularize so I could re-use them throughout my sites. I am attempting to do the same thing in MVC but with partial views and am not having much luck. It's probably something simple, and maybe I'm just not searching on the right set of keywords to find the

Asp.net core razor pages load partial page

試著忘記壹切 提交于 2019-12-21 21:42:27
问题 I use asp.net core 2 new feature Razor pages. in the _layout.cshtml. <body> <div> @await Html.PartialAsync("_LayoutHeader") <div class="row"> <div> <div class="row"> @RenderBody() </div> </div> </div> the _layoutHeader.cshtml is page with code behind. @page @using Microsoft.AspNetCore.Identity @model Yiko.Ent.WebRazorPages.Pages._LayoutHeaderModel and @RenderBody will load index.cshtml with pagemodel. @page @model Yiko.Ent.WebRazorPages.Pages.Home.IndexModel @{ ViewData["Title"] = "Home"; }