Search Results

Search found 12093 results on 484 pages for 'partial classes'.

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

  • How to Render Partial View into an Object

    - by DaveDev
    Hi all, I have the following code: public ActionResult SomeAction() { return new JsonpResult { Data = new { Widget = "some partial html for the widget" } }; } I'd like to modify it so that I could have public ActionResult SomeAction() { // will render HTML that I can pass to the JSONP result to return. var partial = RenderPartial(viewModel); return new JsonpResult { Data = new { Widget = partial } }; } is this possible? Could somebody explain how?

    Read the article

  • Problem Using Partial View In for each loop

    - by leen3o
    I'm a little confused here, I am trying use a partial view in a for each loop like so <% foreach (var item in (IEnumerable<MVCLD.Models.Article>)ViewData["LatestWebsites"]){%> <% Html.RenderPartial("articlelisttemaple", item); %> <% } %> And my partial view looks like this <div class="listingholders"> <h4><%=Html.ActionLink(item.ArticleTitle, "details", "article", new { UrlID = item.UrlID, ArticleName = item.ArticleTitle.ToString().niceurl() }, null)%> </h4> <p><%= Html.Encode(item.ArticleSnippet) %></p> <div class="clearer">&nbsp;</div> </div> But when I run the project I get told the partial view doesn't understand what item is?? CS0103: The name 'item' does not exist in the current context I can't see why it would be doing this as I'm passing item into the partial view?

    Read the article

  • Adding DataAnnontations to Generated Partial Classes

    - by Naz
    Hi I have a Subsonic3 Active Record generated partial User class which I've extended on with some methods in a separate partial class. I would like to know if it is possible to add Data Annotations to the member properties on one partial class where it's declared on the other Subsonic Generated one I tried this. public partial class User { [DataType(DataType.EmailAddress, ErrorMessage = "Please enter an email address")] public string Email { get; set; } ... } That examples gives the "Member is already defined" error. I think I might have seen an example a while ago of what I'm trying to do with Dynamic Data and Linq2Sql.

    Read the article

  • not getting new updated data while using AJAX in calling partial file

    - by dharin
    I have called the partial file form the loop. now when i update , i do not actually get updated result but need to do refresh for getting updated result. the code is like this : the file1 @folders.each do |@folder| = render :partial => 'folders/group_list' the partial file %div{:id => "group_list_#{@folder.id}"} // this is the div which needs to be updated = group_member(@folder) //this is the helper method I need the updated @folder from controller but I always get file1's @folder controller side def any_method .. some code .. @folder = Folder.find(params[:folder_id]) render :partial => '/folders/group_list' end

    Read the article

  • My partial is not where rails expects it to be (nested partials)

    - by new2ruby
    I have a model Submissions which has many Performers. I have a partial for showing an individual submissions (app/views/submissions/_submission.html.erb): <div> Show stuff relating to @submission ... <%= render @performers %> </div> and a partial for showing performers (app/views/performers/_performer.html.erb): <%= div_for performer do %> <%= performer.name %> <% end %> This works fine from (app/views/submissions/show.html.erb): <%= render @submission %> But I want to use this from a different namespace too (app/views/curator/submissions/show.html.erb). But I get this error: Missing partial curator/submissions/submission with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "/Users/ircmullaney/RubyCode/cif/app/views" * "/Users/ircmullaney/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/devise-2.1.2/app/views" I can fix this by changing the render to this: <%= render 'submissions/submission' %> But, then the nested partial fails: Missing partial curator/performers/performer with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "/Users/ircmullaney/RubyCode/cif/app/views" * "/Users/ircmullaney/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/devise-2.1.2/app/views" This doesn't work: <%= render 'performers/performer' %> because of the div_for: undefined method `model_name' for NilClass:Class Any ideas how I should do this?

    Read the article

  • JQuery within a partial view not being called

    - by XN16
    I have a view that has some jQuery to load a partial view (via a button click) into a div in the view. This works without a problem. However within the partial view I have a very similar bit of jQuery that will load another partial view into a div in the first partial view, but this isn't working, it almost seems like the jQuery in the first partial view isn't being loaded. I have tried searching for solutions, but I haven't managed to find an answer. I have also re-created the jQuery function in a @Ajax.ActionLink which works fine, however I am trying to avoid the Microsoft helpers as I am trying to learn jQuery. Here is the first partial view which contains the jQuery that doesn't seem to work, it also contains the @Ajax.ActionLink that does work: @model MyProject.ViewModels.AddressIndexViewModel <script> $(".viewContacts").click(function () { $.ajax({ url: '@Url.Action("CustomerAddressContacts", "Customer")', type: 'POST', data: { addressID: $(this).attr('data-addressid') }, cache: false, success: function (result) { $("#customerAddressContactsPartial-" + $(this).attr('data-addressid')) .html(result); }, error: function () { alert("error"); } }); return false; }); </script> <table class="customers" style="width: 100%"> <tr> <th style="width: 25%"> Name </th> <th style="width: 25%"> Actions </th> </tr> </table> @foreach (Address item in Model.Addresses) { <table style="width: 100%; border-top: none"> <tr id="[email protected]"> <td style="width: 25%; border-top: none"> @Html.DisplayFor(modelItem => item.Name) </td> <td style="width: 25%; border-top: none"> <a href="#" class="viewContacts standardbutton" data-addressid="@item.AddressID">ContactsJQ</a> @Ajax.ActionLink("Contacts", "CustomerAddressContacts", "Customer", new { addressID = item.AddressID }, new AjaxOptions { UpdateTargetId = "customerAddressContactsPartial-" + @item.AddressID, HttpMethod = "POST" }, new { @class = "standardbutton"}) </td> </tr> </table> <div id="[email protected]"></div> } If someone could explain what I am doing wrong here and how to fix it then I would be very grateful. Thanks very much.

    Read the article

  • MVC Rendered Partial, how to get partial/view model in main model post to controller

    - by user1475788
    I have a text file and when users upload the file, the controller action method parses that file using state machine and uses a generic list to store some values. I pass this back to the view in the form of an IEnumerable. Within my main view, based on this ienumerable list I render a partail view to iterate items and display labels and a textarea. Users could add their input in the text area. When the users hit the save button this ienumrable list from the partial view rendered is null. so please advice any solutions. here is my main view @model RunLog.Domain.Entities.RunLogEntry @{ ViewBag.Title = "Create"; Layout = "~/Views/Shared/_Layout.cshtml"; } @using (Html.BeginForm("Create", "RunLogEntry", FormMethod.Post, new { enctype = "multipart/form-data" })) { <div id="inputTestExceptions" style="display: none;"> <table class="grid" style="width: 450px; margin: 3px 3px 3px 3px;"> <thead> <tr> <th> Exception String </th> <th> Comment </th> </tr> </thead> <tbody> @if (Model.TestExceptions != null) { foreach (var p in Model.TestExceptions) { Html.RenderPartial("RunLogTestExceptionSummary", p); } } </tbody> </table> </div> } partial view as follows: @model RunLog.Domain.Entities.RunLogEntryTestExceptionDisplay <tr> <td> @Model.TestException@ </td> <td>@Html.TextAreaFor(Model.Comment, new { style = "width: 200px; height: 80px;" }) </td> </tr> Controller action [HttpPost] public ActionResult Create(RunLogEntry runLogEntry, String ServiceRequest, string Hour, string Minute, string AMPM, string submit, IEnumerable<HttpPostedFileBase> file, String AssayPerformanceIssues1, IEnumerable<RunLogEntryTestExceptionDisplay> models) { } The problem is test exceptions which contains exception string and comment is comming back null.

    Read the article

  • Problem with interface implementation in partial classes.

    - by Bas
    I have a question regarding a problem with L2S, Autogenerated DataContext and the use of Partial Classes. I have abstracted my datacontext and for every table I use, I'm implementing a class with an interface. In the code below you can see I have the Interface and two partial classes. The first class is just there to make sure the class in the auto-generated datacontext inherets Interface. The other autogenerated class makes sure the method from Interface is implemented. namespace PartialProject.objects { public interface Interface { Interface Instance { get; } } //To make sure the autogenerated code inherits Interface public partial class Class : Interface { } //This is autogenerated public partial class Class { public Class Instance { get { return this.Instance; } } } } Now my problem is that the method implemented in the autogenerated class gives the following error: - Property 'Instance' cannot implement property from interface 'PartialProject.objects.Interface'. Type should be 'PartialProjects.objects.Interface'. <- Any idea how this error can be resolved? Keep in mind that I can't edit anything in the autogenerated code. Thanks in advance!

    Read the article

  • LINQtoSQL Custom Constructor off Partial Class?

    - by sah302
    Hi all, I read this question here: http://stackoverflow.com/questions/82409/is-there-a-way-to-override-the-empty-constructor-in-a-class-generated-by-linqtosq Typically my constructor would look like: public User(String username, String password, String email, DateTime birthday, Char gender) { this.Id = Guid.NewGuid(); this.DateCreated = this.DateModified = DateTime.Now; this.Username = username; this.Password = password; this.Email = email; this.Birthday = birthday; this.Gender = gender; } However, as read in that question, you want to use partial method OnCreated() instead to assign values and not overwrite the default constructor. Okay so I got this : partial void OnCreated() { this.Id = Guid.NewGuid(); this.DateCreated = this.DateModified = DateTime.Now; this.Username = username; this.Password = password; this.Email = email; this.Birthday = birthday; this.Gender = gender; } However, this gives me two errors: Partial Methods must be declared private. Partial Methods must have empty method bodies. Alright I change it to Private Sub OnCreated() to remove both of those errors. However I am still stuck with...how can I pass it values as I would with a normal custom constructor? Also I am doing this in VB (converted it since I know most know/prefer C#), so would that have an affect on this?

    Read the article

  • How to render partial.js in rails 3

    - by julian-mann
    Using rails3 - I have a project with many tasks. I want to use javascript to build the UI for each task. I figured I could display those tasks on the projects show page by rendering a javascript partial for each. I can't get 'tasks/show' to see tasks/show.js.erb Any ideas? In projects/show.html.erb <div id="tasks"> <%= render(:partial => "tasks/show", :collection => @project.tasks) %> </div> tasks/show.js.erb $("tasks").append(new TaskWidget(task.id)) I get the errors ActionView::MissingTemplate in Projects#show Missing partial tasks/show with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths .... around line #13 Thanks

    Read the article

  • (partial apply str) and apply-str in clojure's ->

    - by Jason Baker
    If I do the following: user=> (-> ["1" "2"] (partial apply str)) #<core$partial__5034$fn__5040 clojure.core$partial__5034$fn__5040@d4dd758> ...I get a partial function back. However, if I bind it to a variable: user=> (def apply-str (partial apply str)) #'user/apply-str user=> (-> ["1" "2" "3"] apply-str) "123" ...the code works as I intended it. I would assume that they are the same thing, but apparently that isn't the case. Can someone explain why this is to me?

    Read the article

  • How to Render Partial View into a String

    - by DaveDev
    Hi all, I have the following code: public ActionResult SomeAction() { return new JsonpResult { Data = new { Widget = "some partial html for the widget" } }; } I'd like to modify it so that I could have public ActionResult SomeAction() { // will render HTML that I can pass to the JSONP result to return. var partial = RenderPartial(viewModel); return new JsonpResult { Data = new { Widget = partial } }; } is this possible? Could somebody explain how? note, I edited the question before posting the solution.

    Read the article

  • Html.ActionLink in Partial View

    - by olst
    Hi. I am using the following code in my master page: <% Html.RenderAction("RecentArticles","Article"); %> where the RecentArticles Action (in ArticleController) is : [ChildActionOnly] public ActionResult RecentArticles() { var viewData = articleRepository.GetRecentArticles(3); return PartialView(viewData); } and the code in my RecentArticles.ascx partial view : <li class="title"><span><%= Html.ActionLink(article.Title, "ViewArticle", new { controller = "Article", id = article.ArticleID, path = article.Path })%></span></li> The problem is that all the links of the articles (which is built in the partial view) lead to the same url- "~/Article/ViewArticle" . I want each title link to lead to the specific article with the parameters like I'm setting in the partial view. Thanks.

    Read the article

  • Rails partial show latest 5 kases

    - by Danny McClelland
    Hi Everyone, I have my application setup with a few different partials working well. I have asked here how to get a partial working to show the latest entry in the kase model, but now I need to show the latest 5 entries in the kase model in a partial. I have duplicated the show most recent one partial and it's working where I need it to but only shows the last entry, what do I need to change to show the last 5? _recent_kases.html.erb <% if Kase.most_recentfive %> <h4>The most recent case reference is <strong><%= Kase.most_recentfive.jobno %></strong></h4> <% end %> kase.rb def self.most_recentfive first(:order => 'id DESC') end Thanks, Danny

    Read the article

  • When is a scala partial function not a partial function?

    - by Fred Haslam
    While creating a map of String to partial functions I ran into unexpected behavior. When I create a partial function as a map element it works fine. When I allocate to a val it invokes instead. Trying to invoke the check generates an error. Is this expected? Am I doing something dumb? Comment out the check() to see the invocation. I am using scala 2.7.7 def PartialFunctionProblem() = { def dream()() = { println("~Dream~"); new Exception().printStackTrace() } val map = scala.collection.mutable.HashMap[String,()=>Unit]() map("dream") = dream() // partial function map("dream")() // invokes as expected val check = dream() // unexpected invocation check() // error: check of type Unit does not take parameters }

    Read the article

  • How do I use master page container in partial view

    - by user200295
    I have several partial views with Javascript that I am trying to move to the bottom of the page. To do this I am trying to use a container in the master page Master Page - <asp:ContentPlaceHolder ID="Foot" runat="server"></asp:ContentPlaceHolder> Partial view(ascx) <asp:Content ID="header" ContentPlaceHolderID="head" runat="server"> ... </asp:Content> But I get this error Parser Error Message: Content controls have to be top-level controls in a content page or a nested master page that references a master page. So how do I ensure that the Javascript for the partial view is at the bottom of the page? Especially in cases where the html layout needs to be at the top of the page?

    Read the article

  • Passing markup into a Rails Partial

    - by 1ndivisible
    Is there any way of doing something equivilant to this: <%= render partial: 'shared/outer' do %> <%= render partial: 'shared/inner' %> <% end %> Resulting in <div class="outer"> <div class="inner"> </div> </div> Obviously there would need to be a way of marking up 'shared/outer.html.erb' to indicate where the passed in partial should be rendered: <div class="outer"> <% render Here %> </div>

    Read the article

  • how to pass parameter to partial view in MVC4 razor

    - by user2139492
    In my asp.net mvc 4 application i want to pass a parameter to partial view,however the parameter we want to pass is coming from javascript code Below is the code <script> var TestId; $(document).ready(function () { // Send an AJAX request $.getJSON("/api//GetFun?Id="[email protected], function (data) { TestId= data.Id //i am getting the id here which i need to pass in partial view } 1)........... }); </script> html code: <div id="tab1" > 2).... @{ Html.RenderAction("MyPartialView", "MyController", new { id = TestId });} </div> So let me know how can i pass the test id to my partial view :in HTML(2) code or in javascript (1)

    Read the article

  • First Partial Lunar Eclipse in 2010

    - by Suganya
    Following the Annular Solar Eclipse in January 2010, the next eclipse hitting the earth is partial Lunar Eclipse in June 2010. This partial Lunar eclipse is mostly visible to people in America and Pacific side.   The first Lunar Eclipse for the year 2010 occurs on 26th June with the magnitude of 0.5368 and the eclipse lasts for two and a half hours totally. This eclipse is clearly visible for those who are in Western Canada , USA and Eastern Australia. The local timings (24 Hours format) of the cities where the partial solar eclipse is visible are S.No Place Partial Eclipse Begins Partial Eclipse Ends 1 Atlanta 05:17 08:00 2 San Francisco 02:17 05:00 3 Texas 04:17 07:00 4 Los Angeles 02:17 05:00 5 Sydney 20:17 23:00 6 Osaka 19:17 22:00 Join us on Facebook to read all our stories right inside your Facebook news feed.

    Read the article

  • Achieving decoupling in Model classes

    - by Guven
    I am trying to test-drive (or at least write unit tests) my Model classes but I noticed that my classes end up being too coupled. Since I can't break this coupling, writing unit tests is becoming harder and harder. To be more specific: Model Classes: These are the classes that hold the data in my application. They resemble pretty much the POJO (plain old Java objects), but they also have some methods. The application is not too big so I have around 15 model classes. Coupling: Just to give an example, think of a simple case of Order Header - Order Item. The header knows the item and the item knows the header (needs some information from the header for performing certain operations). Then, let's say there is the relationship between Order Item - Item Report. The item report needs the item as well. At this point, imagine writing tests for Item Report; you need have a Order Header to carry out the tests. This is a simple case with 3 classes; things get more complicated with more classes. I can come up with decoupled classes when I design algorithms, persistence layers, UI interactions, etc... but with model classes, I can't think of a way to separate them. They currently sit as one big chunk of classes that depend on each other. Here are some workarounds that I can think of: Data Generators: I have a package that generates sample data for my model classes. For example, the OrderHeaderGenerator class creates OrderHeaders with some basic data in it. I use the OrderHeaderGenerator from my ItemReport unit-tests so that I get an instance to OrderHeader class. The problem is these generators get complicated pretty fast and then I also need to test these generators; defeating the purpose a little bit. Interfaces instead of dependencies: I can come up with interfaces to get rid of the hard dependencies. For example, the OrderItem class would depend on the IOrderHeader interface. So, in my unit tests, I can easily mock the behaviour of an OrderHeader with a FakeOrderHeader class that implements the IOrderHeader interface. The problem with this approach is the complexity that the Model classes would end up having. Would you have other ideas on how to break this coupling in the model classes? Or, how to make it easier to unit-test the model classes?

    Read the article

  • WinForm partial classes

    - by nivlam
    I have a WinForm project that contains a form called MainUI. You can see that the automatically generated partial class shows up as a node under MainUI.cs. Is there a way to "move" my self created partial class MainUI.Other.cs under MainUI.cs so that it'll show as another node?

    Read the article

  • Partial view postback from a standard Html form with MVC

    - by fearofawhackplanet
    I have a file upload button on my MVC view. After the file is uploaded, my FileList partial view on the page should refresh. I tried to upload with Ajax.BeginForm(), but have discovered that Ajax will not submit file data. I've got the file upload working now by using the jQuery Form plugin, which lets you ajaxify the normal Html.BeginForm() submit method. Is is still possible to trigger the partial page update using this method?

    Read the article

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