asp.net-mvc-partialview

styles and scripts not working in partial view

孤人 提交于 2019-12-12 02:04:59
问题 I have a partial view ( asp.net-mvc ) that contains a few dropdownlist 's with the class ''chosen-select'. But somehow that class doesn't get applied. The dropdownlist 's are displayed/styled as 'normal'. @using (var f = Html.Bootstrap().Begin(new Form("Home", "Index").FormMethod(FormMethod.Post).Type(FormType.Horizontal).InputWidthMd(12))) { @f.FormGroup().DropDownListFor(model => model.Currency, Model.Currencies).Class("chosen-select") @f.FormGroup().ListBoxFor(model => model.CountryIds,

Using BeginCollectionItem for adding/deleting Lineitems in MVC5 partialview

落花浮王杯 提交于 2019-12-11 16:06:39
问题 I'm trying to add/delete EnquiryLineItems into Quotation View. Tried to follow MVC 5 Dynamic Rows with BeginCollectionItem BeginCollectionItem partial within partial not behaving correctly MVC 5 BeginCollectionItem with Partial CRUD But while clicking on Add it throws error Failed to load resource: the server responded with a status of 500 (Internal Server Error) and probably constructing wrong URl ( http://localhost:53363/Enquiries/CreateLineItem?_=1505728151541 - as per the error message )

Posting data back to a controller from a Partial View rendered by Ajax

半世苍凉 提交于 2019-12-11 10:22:35
问题 I am returning a Partial View from an Ajax call: $(document).ready(function () { $("#itemSubmitter").click(function (e) { $.ajax({ url: '@Url.Action("GetShippingAddress", "Order")', type: "POST", cache: false, success: function (data) { $("#shoppingAddressWrapper").html(data); } }); }); }); This returns the View as expected. However, the Partial has several Textboxes with data already populated. The #shoppingAddressWrapper is within a Form Tag. When I submit the Form, the values in the

C# MVC 5 Razor: Updating a partial view with Ajax fails

独自空忆成欢 提交于 2019-12-11 08:15:12
问题 My problem is the following: I must refresh a Partial View after clicking on a button. This PartialView contains a table, filled with a foreach loop. I use a controller action, ValidateControl, that gives me the correct data (I've checked it manually). However, using the code below, when I click on my button and the treatment is done, the table is...empty! It doesn't even show up properly. I've checked and it seems unobstrusive ajax and javascript is enabled. I am getting the correct result

In MVC/Razor, how can you open a new view instead of as a partial view?

笑着哭i 提交于 2019-12-11 03:55:07
问题 I have a MVC project with Razor. There is a view with a partial view on the page. I have a button within the partial view that updates the partial view. This works fine. However, I have another button in the view that I want to open a new view; to "break out" of the original view. Instead, this new view opens where the partial page should be. How can I "break out" of the parent view to open a new view? This come out of my previous question: How do I get my MVC page to post to the same action

Using recursive partial view in MVC raises Stack empty InvalidOperationException

时间秒杀一切 提交于 2019-12-11 03:20:10
问题 I want to create a recursive menu with recursive elements. My first approach was to use Partial Views in order to re-use code.. Alas, when I run the code, it throws a "System.InvalidOperationException" "Stack empty" error. I am mapping data from a web service with AutoMapper, which results in the following entity: public interface INavigationItemContract { int Id { get; set; } string Title { get; set; } int ParentId { get; set; } string Url { get; set; } bool DisplayInMenu { get; set; }

How do I pass the string value parameter of the selected list item from an auto-populated dropdown list to a partial view controller in MVC 4?

廉价感情. 提交于 2019-12-11 02:35:38
问题 I have created an auto-populated drop downlist on my MVC 4 web application. When the user selects an item from the dropdown list, I want the partial view to show the item selected rather than all items as it already displays in this partial view. How do I pass the string value parameter of the selected list item from an auto-populated dropdown list to a partial view controller? Here is the code for my auto populated dropdown list: @foreach (var m in ViewDatamodel) { if (m.State == "In Work")

Rendering a partial View with Ajax Unobtrusive

别等时光非礼了梦想. 提交于 2019-12-11 00:34:28
问题 I have the following View and Partial View. In the index action method I need the Create to rendered as a Partial View. Based on the answer in this question I tried using Ajax helper methods(I find AJAX and JS so hard for me to comprehend). @model IEnumerable<TEDALS_Ver01.Models.UserRight> @{ ViewBag.Title = "Index"; } <table class="table"> <tr> <th> @Html.DisplayNameFor(model => model.UserName) </th> <th> @Html.DisplayNameFor(model => model.UserCode) </th> <th> @Html.DisplayNameFor(model =>

Partial ASP.NET MVC View submit

眉间皱痕 提交于 2019-12-10 21:29:43
问题 I'm new in ASP.NET MVC so the question could appear 'stupid', sorry. I have a Partial View inside my Home view. The Partial View submit a form calling an Action Method inside the HomeController. It works fine with server validation, the problem is that after the post only the Partial View is rendered. How can I render the entire Home view after post? About the code: Inside PartialView I have a form: <% using (Html.BeginForm("Request", "Home")) { %> Request is a ActionResult defined inside my

Update Partial View Within Partial View Using MVC Ajax

こ雲淡風輕ζ 提交于 2019-12-10 20:58:38
问题 I have an MVC 5 web application that contains a Razor View called CreateProposal and it accepts a ViewModel called ProposalViewModel. This View, includes a reference to a Partial View called _Proposal which also accepts the ViewModel. CreateProposal View @model STAR.UI.ViewModels.ProposalViewModel <div class="row"> @Html.Partial("_Proposal", Model) </div> The Partial View _Proposal also references another Partial View called _ExistingAttachments which also accepts the ViewModel. _Proposal