FAQ Database Discussion Community


Retrieve partial view data

asp.net-mvc,razor,partial-views,asp.net-mvc-partialview
I have menu and using this I'm rendering partial view in my index page @Ajax.ActionLink("week I", "firstWeekWinners", new { }, new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "weeWinnersDIv", InsertionMode = InsertionMode.Replace }, new { @class = "weekDays wactive" }) and there's partial view controller: public PartialViewResult firstWeekWinners() { ViewBag.laptopWinners...

Render Partial View in Layout MVC 4 with Caching and Data

asp.net-mvc,asp.net-mvc-4,partial-views
I'm new to MVC.NET and I'm working with MVC4 . In a project I should return System Information like Post count, User counts and etc. In My _Layout I have defined a Sidebar which will show these data. here is my sidebar div <div class="sideElement"> <div class="header"> مشخصات سیستم </div>...

Populating table in a partial view

asp.net-mvc,partial-views
I have two model classes, public class Claims //Goes into main view { public int Id { get; set; } public string ClaimName { get; set; } public List<ClaimDetails> ClaimList { get; set; } } public class ClaimDetails //Class I want in my partial view { public int ClaimNumber {...

CodeIgniter - How to dynamically select a menu item in a partial view page for menu?

php,html,codeigniter,partial-views
Basically, I have a menu, which works as a navigation to different pages in my application containing the title of those pages. This menu is created as a partial view. I've a folder named 'partials', inside I've my menu partial view page named 'menu_view.php'. Here's the code of 'menu_view.php': <div...

How do I open a MVC view from the controller they way I would open it from Razor code?

c#,asp.net-mvc,asp.net-mvc-4,razor,partial-views
New to Razor and asp.net MVC, so please take it easy on me. I'm editing a web site created by someone else. I need to open a view from a controller. This view is the home page for my web site, so there's no model for it; there's no information...

How to data-bind an mvc partial view using angularjs directives

angularjs,model-view-controller,partial-views
I have the following angularjs directive: app.directive("partnersInfoView", function ($http) { return { restrict: 'A', link: function ($scope, element) { $http.get("/home/PartnerInfoTab") // immediately call to retrieve partial .success(function (data) { element.html(data); // replace insides of this element with response }); } }; }); which basically goes to an MVC controller and...

Template not loading

javascript,angularjs,angularjs-directive,partial-views
I have a problem that occurs sometimes, when the template entry is not defined in the template cache, it happens every once in a while after reloading the page. The related code: index.html <div ng-include src="'Views/templates.html'"></div> Views/templates.html <script type="text/ng-template" id="customTemplate/spare-request-item.html"> <div>..</div> </script> directive.js .directive("spare", function ($templateCache) { console.log($templateCache.info());, //return length...

How to show something in Layout

layout,asp.net-mvc-5,views,partial-views
I have a standard ASP.NET MVC application, with Layout page and many views. For example, for some users (depend on their properties or by another reason) I want to show something (i.e. additional menu). Layout page: @if (Request.IsAuthenticated && User.IsInRole("Admin")) { <li class="dropdown"> <a aria-expanded="false" class="dropdown-toggle" role="button" href="#" data-toggle="dropdown">Admin <span...

Create child object using jQuery dialog/partial view

jquery,asp.net-mvc,asp.net-mvc-5,partial-views,jquery-dialog
I am using MVC 5/jquery 1.10.2 and jquery ui 1.11.3 For this example I have a Parent object with one child object. On the Create View for the parent object I have an auto-complete text box from which the user selects one of the children. If the child does not...

AngularJS UI-router, partial views and calling view from browser's location bar

javascript,angularjs,partial-views,angular-ui-router
I have this router entries $locationProvider.html5Mode(true); .state("main", { url: "/", views: { '' : { templateUrl: 'views/main.html' }, '[email protected]': { templateUrl: 'views/gdreport.html', controller : 'GlobalDashboardController' } } }) .state("main.odometer", { url: "/odometer", views: { '[email protected]': { templateUrl: 'views/odometer.html' } } }) It's working fine when using mouse. I get redirected...

How to include a Partial but only if it wasn't yet included?

asp.net-mvc,knockout.js,partial-views
I use ASP.NET MVC5 together with knockout.js. I have several knockout.js templates, orginized into partial views. When I have a component in a view or partial view, which needs one or more specific template, I include the corresponding templates with Html.Partial. However, there is a problem I need to solve:...

How to get partial view to asynchronously get data from controller. Perceived Performance application

c#,asp.net-mvc,asynchronous,partial-views
Update: I have a page that loads an html view as follows: <div class="center-box"> <div id="ourTeam"> <div class="arrowLeft"></div> <div class="arrowRight"></div> </div> <div class="containerParent"> @Html.Partial("Team", Model.TeamMembers == null ? new List<UsersViewModel>() : Model.TeamMembers) </div> </div> The model passed into this view is PagesViewModel which includes a bunch of display variables and...

Is using too many partial views a bad practice?

c#,asp.net-mvc,asp.net-mvc-4,razor,partial-views
I am very new to MVC design paradigm and I am laying out my first MVC Application which has a Grid full of employees and as soon as you click on each employee on the grid it loads more details about the employee in the Tab control below. Tab control...

Apply ko bindings to partial view

knockout.js,partial-views
I have a ko viewmodel. I want to render a partial view twice on the same page. Once for physical address and once for postal address. They have the same properties, the data is just different. There is no client side knockout parent view model which contains both physical and...

Naming conventions in MVC5

c#,asp.net-mvc,model-view-controller,naming-conventions,partial-views
So I'm working on my first true MVC website development (before now I've been using a template which was already developed). There we had a controller for controls (forms etc.) and then another controller just to deal with all HttpPost actions etc. Because of this is meant I could have...

Rails Partials and Simple Form Answers

ruby-on-rails,partial-views
I'm using Simple Form with my Rails 4 app. I have a structure which has models for each of projects, scopes, and data. Data belongs to scopes, scopes belong to projects. I have just made a partial view for data which should be displayed in the projects show page if...

Call JavaScript from within an ASP.NET MVC Partial View

javascript,c#,asp.net-mvc,partial-views
I have created an ASP.NET MVC partial view and I am calling it via the HTML.Action helper method: @Html.Action("GetMyPartialView", "MyController", new { myParameter}) The partial view contains a control that needs some JavaScript to be called (a JavaScript library in an external JavaScript file). How can I call this JavaScript...

Pass model tproperty expression to partial

asp.net-mvc-4,razor,partial-views
I have a lot of yes / no radio buttons on a form like this: <div class="form-row"> @Html.DisplayNameFor(m => m.OptIn48Hours)<br /> <label>@Html.RadioButtonFor(m => m.OptIn48Hours, "true") Yes</label> <label>@Html.RadioButtonFor(m => m.OptIn48Hours, "false") No</label> @Html.ValidationMessageFor(m => m.OptIn48Hours) </div> So I thought I would make this into a partial @model object <div class="form-row"> @Html.DisplayNameFor(Model)<br...

How to get selected value of dropdown when using partial view in mvc?

javascript,jquery,asp.net-mvc-4,partial-views,cascadingdropdown
I am using partial view to display a view inside another and the partial view has the drodown so how to get the value of that dropdown actually i want to display another dropdown based on the value of the first dropdown here is my code in detail: partial view:...

angularJS, a notification partial or modal that gets loaded for a few seconds and then disappears

javascript,angularjs,node.js,modal-dialog,partial-views
Hi I am currently building an app using angularJS nodeJs. One of the features is to have individuals be able to send an email from the app. To do this they click a button which opens up a modal window. They fill out the form and then hit send. This...

Partial View in kendo grid column

c#,ajax,asp.net-mvc,partial-views,kendo-asp.net-mvc
I have an ajax enabled kendo grid with a client template that displays data from the model to which the row is bound. (because of ajax, using columns.Template seems not possible.) @(Html.Kendo().Grid<Model>() .Columns(columns => { columns.Bound(x => x.SubModel).ClientTemplate("bla #= SomePropertyOfSubModel # bla") }) .DataSource(dataSource => dataSource.Ajax()) This works basically, but...

HTML snippet in Angular partial missing in view

javascript,angularjs,partial-views,partial,partials
I have a block of HTML in an Angular partial that's not making it into the view for some reason. Every other line of HTML in the partial (including other lines with data-binding and references to my service and its methods) are making it in. Had a hard time locating...

How to work with a partial view within a view for same model?

c#,asp.net-mvc,entity-framework,asp.net-mvc-4,partial-views
I have a simple form with below functionalities. First Part: It has a table which will display value from a database table, e.g. tblProfile and it contains three columns like profileid, profilename, description and in each row an edit button to edit values. Second Part: In the same page, I...

trouble with rails rendering partial and finding custom controller

ruby-on-rails,ruby-on-rails-4,partial-views
Background: I would like to make a team and have the user verify the address of that team before the team is saved. In my application I have a form that creates a team when the form is submitted. Within this form I have a partial that is suppose to...

MVC Partial View is not rendering correctly in main View

asp.net-mvc,twitter-bootstrap,asp.net-mvc-4,partial-views,asp.net-mvc-partialview
Question Background: I have an MVC partial view that is called from an ActionLink method and renders a dropdown list from the passed View Model. To add to this I am using the Twitter Bootstrap framework within this project. The issue: The partial view is not being rendered correctly -...

PartialView MVC - PartialView functionality different than View

asp.net-mvc,pagination,partial-views
I have a 'Ticket' View with a partial View of "Comments". A Ticket can have many comments. I want to create a partial view of Comments inside the Ticket view so that I can add paging functionality to the Comments without impacting the ticket view. (I'll have 2 other partials...

@HTML.Partial use generic class for the same property in different classes

c#,asp.net-mvc,partial-views,asp.net-mvc-partialview
I have in my project several classes that have the same property. Example: PersonID. This property is linked to Person table, I create a select box with two buttons. Instead of doing this to the views that have PersonID: <div class="col-md-12"> @Html.LabelFor(m => m.PersonID) @Html.ValidationMessageFor(m => m.PersonID) <div class="input-group"> @Html.DropDownList("PersonID",...

How can I call the same Action on every page?

c#,asp.net,asp.net-mvc,asp.net-mvc-4,partial-views
I have the following ActionResult that I would like to call on my _Layout view. The properties will be used to control what displays on the navigation bar: [ChildActionOnly] public ActionResult GenerateLayout() { var loseATonEvent = db.Events.Max(e => e.EventId); var currentUser = User.Identity.Name; currentUser = currentUser.Contains('\\') ? currentUser.Substring(currentUser.LastIndexOf('\\') + 1)...

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

asp.net-mvc,asp.net-mvc-4,razor,partial-views,asp.net-mvc-partialview
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;...

ASP.NET MVC 5 - “Create” view that can handle any number of elements for an IEnumberable based on clicking an “Add row” button?

c#,asp.net,asp.net-mvc,asp.net-mvc-5,partial-views
I am writing a recipe manager for my wife in C#/.NET MVC 5. I'm getting to the page for creating a recipe, and I'm a little stumped. A recipe consists of a Name and a list of ingredients. When I create a view, I have my form: @using(Html.BeginForm()){ //Form elements...

Using Kendo Grid in PartialView

asp.net-mvc,kendo-ui,kendo-grid,partial-views,kendo-asp.net-mvc
I have two section in the Index view of my MVC application and I want to render two PartialView to these sections. There is no problem to render kendogrid to one Index. However, in order to render data on KendoGrid Could I use the two methods returning Json in the...