Search Results

Search found 7897 results on 316 pages for 'partial views'.

Page 4/316 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to test views in ASP.NET MVC2 (ala RSpec)

    - by Dmitriy Nagirnyak
    Hi, I am really missing heavily the ability to test Views independently of controllers. The way RSpec allows to do it. What I want to do is to perform assertions on the rendered view (where no controller is involved!). In order to do so I should provide required Model, ViewData and maybe some details from HttpContextBase (when will we get rid of HttpContext!). So far I have not found anything that allows doing it. Also it might heavily depend on the ViewEngine being used. List of things that views might contain are: Partial views (may be nested deeply). Master pages (or similar in other view engines). Html helpers generating links and other elements. Generally almost anything in a range of common sense :) . Also please note that I am not talking about client-side testing and thus Selenium is just not related to it at all. It is just plain .NET testing. So are there any options to actually do the testing of views? Thanks, Dmitriy.

    Read the article

  • Test Views in ASP.NET MVC2 (ala RSpec)

    - by Dmitriy Nagirnyak
    Hi, I am really missing heavily the ability to test Views independently of controllers. The way RSpec does it. What I want to do is to perform assertions on the rendered view (where no controller is involved!). In order to do so I should provide required Model, ViewData and maybe some details from HttpContextBase (when will we get rid of HttpContext!). So far I have not found anything that allows doing it. Also it might heavily depend on the ViewEngine being used. List of things that views might contain are: Partial views (may be nested deeply). Master pages (or similar in other view engines). Html helpers generating links and other elements. Generally almost anything in a range of common sense :) . Also please note that I am not talking about client-side testing and thus Selenium is just not related to it at all. It is just plain .NET testing. So are there any options to actually do the testing of views? Thanks, Dmitriy.

    Read the article

  • DRYing up Rails Views with Nested Resources

    - by viatropos
    What is your solution to the problem if you have a model that is both not-nested and nested, such as products: a "Product" can belong_to say an "Event", and a Product can also just be independent. This means I can have routes like this: map.resources :products # /products map.resources :events do |event| event.resources :products # /events/1/products end How do you handle that in your views properly? Note: this is for an admin panel. I want to be able to have a "Create Event" page, with a side panel for creating tickets (Product), forms, and checking who's rsvp'd. So you'd click on the "Event Tickets" side panel button, and it'd take you to /events/my-new-event/tickets. But there's also a root "Products" tab for the admin panel, which could list tickets and other random products. The 'tickets' and 'products' views look 90% the same, but the tickets will have some info about the event it belongs to. It seems like I'd have to have views like this: products/index.haml products/show.haml events/products/index.haml events/products/show.haml But that doesn't seem DRY. Or I could have conditionals checking to see if the product had an Event (@product.event.nil?), but then the views would be hard to understand. How do you deal with these situations? Thanks so much.

    Read the article

  • Strategies for Mapping Views in NHibernate

    - by Nathan Fisher
    It seems that NHibernate needs to have an id tag specified as part of the mapping. This presents a problem for views as most of the time (in my experience) a view will not have an Id. I have mapped views before in nhibernate, but they way I did it seemed to be be messy to me. Here is a contrived example of how I am doing it currently. Mapping <class name="ProductView" table="viewProduct" mutable="false" > <id name="Id" type="Guid"> <generator class="guid.comb" /> </id> <property name="Name" /> <!-- more properties --> </class> View SQL Select NewID() as Id, ProductName as Name, --More columns From Product Class public class ProductView { public virtual Id {get; set;} public virtual Name {get; set;} } I don't need an Id for the product or in the case of some views I may not have an id for the view, depending on if I have control over the View Is there a better way of mapping views to objects in nhibernate?

    Read the article

  • Rendering a derived partial view with Html.RenderPartial

    - by FreshCode
    Calling Html.RenderPartial("~/Views/Payments/MyControl.ascx"); from a view works if Method.ascx is a control that directly inherits System.Web.Mvc.ViewUserControl. However, if the control inherits a new class that derives from System.Web.Mvc.ViewUserControl, the call to Html.RenderPartial("~/Views/Payments/MyDerivedControl.ascx"); fails, reporting that no such view exists. Example derived ViewUserControl: class MyDerivedControl : System.Web.Mvc.ViewUserControl { public Method() { ViewData["SomeData"] = "test"; } } Is there a workaround, or is there another way I should be doing this? Perhaps an HTML helper?

    Read the article

  • Storing ASP.Net MVC Views in the Database

    - by Adam Albrecht
    For an ASP.Net MVC application, I'm interested in storing some views and/or partial views in the database so that a few semi-technical users can do some basic view logic. Does anyone have any tips or lessons from experience on doing this? I know Phil Haack wrote a blog post on this about a year ago. He used IronRuby for scripting his views, (which would be fine for me). He created a quick proof-of-concept, but I can't find any other information on the topic. Any ideas, thoughts, tips, etc would be appreciated. Thanks!

    Read the article

  • How do views reduce code duplication?

    - by Debuger
    Hi! I read something like this about db views: Views are incredibly powerful and useful for one reason that stands out above all the other very good reasons. They reduce code duplication. That is, in most cases, the bottom line. If a query will be used in three or more places, then a view will drastically simplify your changes if the schema or query parameters change. I once had to edit 22 stored procedures to change some query logic. If the original architecture had utilized views, then I would have had only three changes. Can anyone explain to me how it works, and maybe give me some examples? Best regards!

    Read the article

  • Embedded strongly-typed views with ASP.NET MVC

    - by Brian Vallelunga
    I'm working on a plugin-type of system for ASP.NET MVC that loads views from an embedded assembly. I have created a VirtualPathProvider that does the work of retrieving out of the assembly. Everything is working fine except for strongly-typed views. Whenever I try to load one of those, I get an exception of: Could not load type 'System.Web.Mvc.ViewPage'. The problem is that there is no Web.config file under the Views folder. Well, actually there is, but the system doesn't seem to want to read the embedded version. If I manually create the file under the corresponding directory in the web app, everything is fine. This isn't an acceptable workaround however, as each plugin would need its own file in its own specific directory. Does anyone know how I might get ASP to read the embedded Web.config file? Thanks, Brian

    Read the article

  • Drupal, Views: header doesn't accept PHP..

    - by Patrick
    hi, I'm using Views for some nodes, and I want to display a different View title according to which taxonomy tags are selected in my filter. I already have taxonomy field for each node in my view. But this is not what I need. I basically need to display all the currently filtered tags on the top of my view. I was wondering if I can solve adding some line with php, how ? Thanks Update: I'm now using the Views Header field in Views settings, but it only processes html code, not php, so I cannot add taxonomy terms. Is it because of my CCK Editor settings ? thanks

    Read the article

  • Calling a MVC2 partial view using jquery returns empty string problem

    - by Jason
    I have an issue where I have a partial view that returns some HTML to be displayed. Its called when something is clicked on the page using jquery. The problem is that no matter how I call it, i get back an empty string even though it reports success. This is happening to me using Chrome, going against my local machine. My controller looks like this: public ActionResult MyPartialView() { return PartialView(model); } I have tried jquery using .get(), .post() and .load() and all have the same results. Here is an example using .post(): $.post(url, function (data) { alert(data); }); The result always comes back as an empty string. I can navigate to the partial view in the browser manually and i get back the desired HTML. The URL I am using to call it I resolved fully so it looks like "http://localhost/controller/mypartialview" rather than using the relative path of "/controller/mypartialview" which I thought was the original problem. Any idea what may cause this?

    Read the article

  • putting <%=yield %> in a partial for ajax jquery calls

    - by odpogn
    I'm trying to make the "home" link in my <%= render 'layouts/header' %> do an ajax/jquery call to change the <%= yield %> in a partial inside my content div. all i get are blanks in the view.. <%= yield %> works fine when put in a partial without ajax, but it doesn't display anything when using ajax... can yield not be used this way? all I'm really looking for is the ability to click on my sites navigation links without having to reload the entire page... my application.html.erb file looks like so: <head> $(function() { $("#home").live("click", function() { $.get(this.href, null, null, "script"); return false; }); }); </head> <body> <div id="container"> <%= render 'layouts/header' %> <div id="content"> <%= render 'layouts/content' %> </div> <%= render 'layouts/footer' %> </div> </body> my <%= render 'layouts/header' %> contains: <%= link_to "Home", root_path, :id => "home" %> my <%= render 'layouts/content' %> only contains: <%= yield %> home.js.erb $("#content").html("<%= escape_javascript(render("layouts/content")) %>");

    Read the article

  • designing an ASP.NET MVC partial view - showing user choices within a large set of choices

    - by p.campbell
    Consider a partial view whose job is to render markup for a pizza order. The desire is to reuse this partial view in the Create, Details, and Update views. It will always be passed an IEnumerable<Topping>, and output a multitude of checkboxes. There are lots... maybe 40 in all (yes, that might smell). A-OK so far. Problem The question is around how to include the user's choices on the Details and Update views. From the datastore, we've got a List<ChosenTopping>. The goal is to have each checkbox set to true for each chosen topping. What's the easiest to read, or most maintainable way to achieve this? Potential Solutions Create a ViewModel with the List and List. Write out the checkboxes as per normal. While writing each, check whether the ToppingID exists in the list of ChosenTopping. Create a new ViewModel that's a hybrid of both. Perhaps call it DisplayTopping or similar. It would have property ID, Name and IsUserChosen. The respective controller methods for Create, Update, and Details would have to create this new collection with respect to the user's choices as they see fit. The Create controller method would basically set all to false so that it appears to be a blank slate. The real application isn't pizza, and the organization is a bit different from the fakeshot, but the concept is the same. Is it wise to reuse the control for the 3 different scenarios? How better can you display the list of options + the user's current choices? Would you use jQuery instead to show the user selections? Any other thoughts on the potential smell of splashing up a whole bunch of checkboxes?

    Read the article

  • Passing additional data value to strongly typed partial views in ASP.NET MVC

    - by fearofawhackplanet
    I have an OrderForm domain class, which has property subclasses, something like: interface IOrderForm { int OrderId { get; } ICustomerDetails CustomerDetails { get; set; } IDeliveryDetails DeliveryDetails{ get; set; } IPaymentsDetails PaymentsDetails { get; set; } IOrderDetails OrderDetails { get; set; } } My "Details" view is strongly typed inheriting from IOrderForm. I then have a strongly type partial for rendering each section: <div id="CustomerDetails"> <% Html.RenderPartial("CustomerDetails", Model.CustomerDetails); %> </div> <div id="DeliveryDetails"> <% Html.RenderPartial("DeliveryDetails", Model.DeliveryDetails); %> </div> ... etc This works ok up to this point, but I'm trying to add some nice ajax bits for updating some parts of the order form, and I've realised that each of my partial views also needs access to the IOrderForm.OrderId. Whats the easiest way to give my partials access to this value?

    Read the article

  • What's special about currying or partial application?

    - by Vigneshwaran
    I've been reading articles on Functional programming everyday and been trying to apply some practices as much as possible. But I don't understand what is unique in currying or partial application. Take this Groovy code as an example: def mul = { a, b -> a * b } def tripler1 = mul.curry(3) def tripler2 = { mul(3, it) } I do not understand what is the difference between tripler1 and tripler2. Aren't they both the same? The 'currying' is supported in pure or partial functional languages like Groovy, Scala, Haskell etc. But I can do the same thing (left-curry, right-curry, n-curry or partial application) by simply creating another named or anonymous function or closure that will forward the parameters to the original function (like tripler2) in most languages (even C.) Am I missing something here? There are places where I can use currying and partial application in my Grails application but I am hesitating to do so because I'm asking myself "How's that different?" Please enlighten me.

    Read the article

  • MVC - Ajax form - return partial view doesnt update in <div> target

    - by Jack
    I have an index view that I want to update automatically as the user types in a client id. I got something similiar to work (only it was updating just a label) - but this will not work. What happens is the partial is just rendered by itself (not in place of the UpdateTargetID). So the data is rendered on a new page. Here is my code: Controller: public ActionResult ClientList(string queryText) { var clients = CR.GetClientLike(queryText); return PartialView("ClientIndex", clients); } Partial View: <table> <thead> <tr> <td>Client ID</td> <td>Phone1</td> <td>Phone2</td> <td>Phone3</td> <td>Phone4</td> </tr> </thead> <tbody> <% if (Model != null) { foreach (Client c in Model) { %> <tr> <td><%= Html.Encode(c.ClientID)%></td> <td><%= Html.Encode(c.WorkPhone)%></td> <td><%= Html.Encode(c.WorkPhone1)%></td> <td><%= Html.Encode(c.WorkPhone2)%></td> <td><%= Html.Encode(c.WorkPhone3)%></td> </tr> <% } } %> </tbody> Main View: Insert code messed up, so this is just copy/pasted: $(function() { $("#queryText").keyup(function() { $('#sForm').submit(); }); }); <% using (Ajax.BeginForm("ClientList", /* new { queryText = Form.Controls[2] ?? }*/"", new AjaxOptions { UpdateTargetId = "status", InsertionMode = InsertionMode.Replace }, new { @id = "sForm" })) { % <% } % <div id="status" class="status" name="status"> <%--<% Html.RenderPartial("ClientIndex", ViewData["clients"]); %> Should this be here???? --%> </div>

    Read the article

  • ASP.NET MVC 2 loading partial view using jQuery - no client side validation

    - by brainnovative
    I am using jQuery.load() to render a partial view. This part looks like this: $('#sizeAddHolder').load( '/MyController/MyAction', function () { ... }); The code for actions in my controller is the following: public ActionResult MyAction(byte id) { var model = new MyModel { ObjectProp1 = "Some text" }; return View(model); } [HttpPost] public ActionResult MyAction(byte id, FormCollection form) { // TODO: DB insert logic goes here var result = ...; return Json(result); } I am returning a partial view that looks something like this: <% using (Html.BeginForm("MyAction", "MyController")) {%> <%= Html.ValidationSummary(true) %> <h3>Create my object</h3> <fieldset> <legend>Fields</legend> <div class="editor-label"> <%= Html.LabelFor(model => model.ObjectProp1) %> </div> <div class="editor-field"> <%= Html.TextBoxFor(model => model.Size.ObjectProp1) %> <%= Html.ValidationMessageFor(model => model.ObjectProp1) %> </div> div class="editor-label"> <%= Html.LabelFor(model => model.ObjectProp2) %> </div> <div class="editor-field"> <%= Html.TextBoxFor(model => model.ObjectProp2) %> <%= Html.ValidationMessageFor(model => model.ObjectProp2) %> </div> <p> <input type="submit" value="Create" /> </p> </fieldset> <% } %> Client side validation does not work in this case. What is more the script that contains validation messages also isn't included in the view that's returned. Both properties in my model class have Required and StringLength attributes. Is there any way to trigger client side validation in a view which has been loaded like this?

    Read the article

  • $(document).ready() and partial view load

    - by user252160
    I am developing an application using Asp.net mvc and jquery. I'd like to use the same naming convention (classes and ids) for html elements in different views. In case when I want to load a partial view asynchronously, the $(document).ready() piece of code in the main view loses its usefulness because none of the patial view's html tags and css naming is recognized by jquery. I certainly do not want to write the same code for every view. What's th ebest way to solve this issue?

    Read the article

  • Rails: DRY in views, I need help

    - by Totty
    Hy, I have a layout in the views/layout that has 2 cols and then in every view i have content_for :main_col and content_for :side_col. The problem is that i have more than 5 views with the same content in the content_for :side_col You have a better idea on how to do this?thanks

    Read the article

  • ColdFusion CFC implementation of C# Partial Class?

    - by Brian David Berman
    Does ColdFusion offer a mechanism for splitting CFCs into multiple files? I am NOT talking about extension, I am talking about splitting the SAME CFC into multiple files; the same way C# allows for "partial" classes. The reason for this is because I am using T4 to generate a bunch of CFCs and I want to be able to tag functionality onto the generated CFC by doing so in another file. I want to do this in a way that doesn't violate the Open-Closed Principle.

    Read the article

  • drupal views module error

    - by peter
    hey guys.. i installed drupal views module and am getting this error Fatal error: require_once() [function.require]: Failed opening required './sites/all/modules/views/includes/admin.inc' (include_path='.:/usr/lib64/php:/usr/lib/php') how can i solve this problem? thanks

    Read the article

  • how to access cck checkbox value from views .tpl

    - by romandor
    Subject for advanced views theming: 1) Create CCK integer field "field_checkbox" - Single on/of checkbox Allowed values 0|No 1|Yes 2) In views row-style .tpl <?php print $fields['field_checkbox_value']->content ?> doesn't print any value, why? Other fields output fine. Thank you in advance!

    Read the article

  • advance/basic and smartphone views in Rails

    - by aleds
    In a new Rail app I have to consider 2 differents user's type: basic and Advanced and I have to create smartphone views( unique view for both user's type). Then I have 3 view/layout: - web advance - web basic - smartphone I already have the adv/basic flag for the user, and I followed the RBates tutorial http://asciicasts.com/episodes/199-mobile-devices. What is the best way to manage the 3 views/layout ?

    Read the article

  • Removing a view from Eclipse Window -> Show views

    - by RCP
    We have an application in which some views only work when attached to certain perspectives. We want to remove those views from the Window - Show View menu so that users cannot add them to perspectives where they don't work. Any ideas on how to do this either programmatically or declaratively?

    Read the article

  • T-SQL Tuesday #24 : Dude, where's the rest of my procedure?

    - by AaronBertrand
    This month's T-SQL Tuesday is being hosted by Brad Schulz ( blog ) and the topic is one that should attract a lot of submissions: Procedures and Functions. Last week, I talked about the case against INFORMATION_SCHEMA views - I provided several examples where I feel the INFORMATION_SCHEMA views fall short of the catalog views, and expressed my belief that you are better off programming consistently against the catalog views all the time, instead of only when the INFORMATION_SCHEMA views fail. Having...(read more)

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >