partial-views

CodeIgniter load controller within a controller HMVC

自作多情 提交于 2019-12-20 07:26:38
问题 I'm using http://github.com/philsturgeon/codeigniter-template/ for the templates and I trying to load other controller view to actual view as a partial. My main problem is that I cant append meta data (javascripts, css) from other controller to the main controller. application/core/MY_Loader.php class MY_Loader extends CI_Loader { function __construct() { parent::__construct(); } function controller( $sController ) { global $RTR; // Parse the sController string ex: demo/index $aControllerData

How to implement Laravel 4 Partial Views - Binding data to partial views

和自甴很熟 提交于 2019-12-19 04:07:08
问题 I am debating whether I should use Laravel to build an online store. Requirement - Show a shopping cart in sidebar with product listing in main area. i need to bind data to my partial views. I have created a PartialController to display partial views. class PartialController extends BaseController { public function showCartSummary() { $cartItems = Cart::all(); return View::make('partials.cartsummary', array( 'cart' => $cartItems, )); } public function showProducts() { $products = Products:

ASP.Net MVC Passing multiple parameters to a view

拥有回忆 提交于 2019-12-19 00:17:09
问题 In ASP.Net MVC I would like to render a different partial view depending on the renderview query string parameter. Therefore providing the facility for the user to choose to view products by thumbnail or by details. I have access to the chosen parameter in the controller but I do not know how to or, if I should be passing this to the view along with the products list so the view can implement the logic for deciding which partial view to display? public ActionResult Products(string id, int?

Using an interface as the model type of a partial view + data annotations

喜你入骨 提交于 2019-12-18 22:32:49
问题 I have a case where a complex partial view needs different validation of fields depending on where the partial view is used. I thought I could get around this by making the partial view take an interface as the model type and implementing two different ViewModels based on the interface. The data annotations in the two ViewModels would be different. I would then supply an instance of the correct ViewModel to the partial view. But what I'm finding is that the only annotations that are

ASP.NET MVC “Components”

独自空忆成欢 提交于 2019-12-18 15:33:17
问题 Is there someway to have a part of the page that renders like a little sub-page, like components? For example, if I have a shopping cart on all my pages? 回答1: If you want it to render another controllers action, as a component, to get encapsulation, you use. Html.RenderAction uses routedata to get you there, has its own viewdata and kind of mini life cycle 回答2: Using preview 5, Html.RenderPartial is your man, you can render sub-controls, and pass them your viewdata, or an arbitrary model, and

json erb template cannot find other html partial

£可爱£侵袭症+ 提交于 2019-12-18 15:31:32
问题 I am trying to have a json response in which some value is html rendered by a partial #projects_Controller.rb def index respond_to do |f| f.json end end # index.json.erb { "html":"<%= raw escape_javascript(render :partial => 'projects/disclaimer') %>" } But I get the following error: ActionView::Template::Error (Missing partial projects/disclaimer with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=> [:json], :locale=>[:en, :en]} in view paths "c:/rails/app/views", "c:/rails

load partial view in to a modal popup

。_饼干妹妹 提交于 2019-12-18 13:31:40
问题 I am working with MVC3 c# 4.0. I have created a partial view. I have a button on my page, when I click this button I want to be able to load the partial view in to a modal popup. I presume the best way to do this is via javascript - I am using jQuery already in the application. Any pointers as to how I could do this? 回答1: You could use jQuery UI dialog. So you start by writing a controller: public class HomeController : Controller { public ActionResult Index() { return View(); } public

Paging/Sorting not working on web grid used in Partial View

≡放荡痞女 提交于 2019-12-18 04:28:22
问题 I have a partial view where I am showing a web grid depending upon a value selected from a page. For drop down I have used @Html.DropDownListFor( x => x.ItemId, new SelectList(Model.Items, "Value", "Text"), new { id = "myddl", data_url = Url.Action("Foo", "SomeController") } ) For drop down item select I have used $(function() { $('#myddl').change(function() { var url = $(this).data('url'); var value = $(this).val(); $('#result').load(url, { value: value }) }); }); and below is my action

Render Partial to String in the Controller or elsewhere

三世轮回 提交于 2019-12-18 04:16:13
问题 So basically I have a partial view which can build a nice table for me. I would like to email this table out every week to my users. Instead of having to basically copy the template again, I would like to forward my model to the controller and receive the corresponding generated HTML as a String . Is it possible to do this in a Controller, I feel it should be a pretty simple process. 回答1: Put this into a Helper file: public static string RenderViewToString(ControllerContext context, string

How to update a div with Ajax.BeginForm AND execute a javascript function?

戏子无情 提交于 2019-12-18 04:04:15
问题 I am updating a div with a partial view by using something like this: <% using (Ajax.BeginForm("Action", "Controller", new { id=Model.id }, new AjaxOptions { UpdateTargetId = "divId", InsertionMode = InsertionMode.InsertAfter, })) { %> and its working fine, the returned view gets appened to the div, however I now need to execute a javascript when the post is successful, so I thought: "easy, just add OnSuccess = "MyJsFunc()" " to the AjaxOptions , but after doing this, it stopped working! now