partial

Should you use a partial class across projects

Ok, So, I have a class library with all my database logic. My DAL/BLL. I have a few web projects which will use the same database and classes, so I thought it was a good idea to abstract the Data Layer into its own project. However, when it comes to adding functionality to classes for certain projects I want to to add method to cer...

How do I render a partial of a different format in Rails?

I'm trying to generate a JSON response that includes some HTML. Thus, I have /app/views/foo/bar.json.erb: { someKey: 'some value', someHTML: "<%= h render(:partial => '/foo/baz') -%>" } I want it to render /app/views/foo/_baz.html.erb, but it will only render /app/views/foo/_baz.json.erb. Passing :format => 'html' doesn't help. ...

Rails AJAX: My partial needs a FormBuilder instance

So I've got a form in my Rails app which uses a custom FormBuilder to give me some custom field tags <% form_for :staff_member, @staff_member, :builder => MyFormBuilder do |f| %> [...] <%= render :partial => "staff_members/forms/personal_details", :locals => {:f => f, :skill_groups => @skill_groups, :staff_member => @staff_member} %...

JSF Multiple Partial Validations Scenario

In JSF, is it possible to solve the following validation / updating scenario using the validation framework of JSF (aka validators, immediate, required, etc.)? +-- Form ----------------------------------------------------+ | | | Field A: |____________|v| ...

Is it possible to have two partial classes in different assemblies represent the same class?

I have a class called 'Article' in a project called 'MyProject.Data', which acts as the data layer for my web application. I have a separate project called 'MyProject.Admin', which is a web-based admin system for viewing/editing the data, and was build using ASP.NET Dynamic Data. Basically I want to extend the Article class, using a pa...

Return surrounding text for phrase found in full-text search, SQL 2005

I'm using a contains predicate to find phrases in a SQL Server indexed text field. Is there a way to return the portion of the text field that contains the searched phrase, or some area around it? For example, if I'm searching for "all men are created equal" in the Gettysburg address (excerpted below), I'd like to return "dedicated to ...

How to automatically convert VS2003 classes to partial Designer.cs files?

I'm upgrading a project from Visual Studio 2003 to 2008 and wish to automatically generate XXX.Designer.cs files and update the corresponding XXX.cs original one. Any automatic way to do it? UPDATE: I'm referring to WinForms. Of course, I know the old style works but i'm looking for a way to go to the new style without doing it by hand...

Render View (or Partial) In another project?

Hello, i have a solution with the following two projects - MyNamespace.Services and MyNamespace.Web. Web contains a MVC web application. In the Service project i have a EmailService class that takes care of sending out emails to the user. I want to use either a partial or a view (ascx or aspx) for email templates. I have found severa...

Rails Partial Image Rendering

Hey everyone, I'm getting up to speed on rails and ran into an odd problem. I'm rendering some images from the database (Image models attached to another model, Plants). I'm having some trouble when attempting to do it via a partial. I've got show.html.erb <fieldset class="fieldset"> <legend>Images</legend> <%= unle...

returning partially distinct/unique rows

Hi all, I need to create a query which groups by two columns and returns an additional column based on a condition. For example, say I've got the following columns: ProductCode | SerialNumber | Quantity | DatePurchased | CustomerID and the table contains duplicate combinations of ProductCode and SerialNumber with differing Quanitite...

JQuery Grid or Loop through partial views?

Hello Has anyone been able to customize jQGrid? While I'd like something easy I can pluing and use that provides paging, I find that the layout is "tight" ( not in the cool way ) the gird is too excel-like. I'd much prefer one with spaced out grid rows and ability to use icons. But before I write the grid off and start hand rolling a...

inserting extra data in linq to sql partial class

I have a L2S generated class called Accounts, I have a L2S class called UsersInAccounts I need to add a function call AddUserToAccount(accountid, userid) should/could this function be added to the partial Accounts class I have created or are partial classes used for getting data rather than editing data public partial class Account ...

AJAX postback and page lifecycle

Could anybody explain me how it works. I have a page, which has button inside the update panel and some class member (_pageContext). It is not static member, by the way That's its declaration internal PageContext _pageContext = null; When I click the button, next events occurs (I trace them making breakpoints) 1) Page constructo...

C++ Partial Specialization ( Function Pointers )

Can any one please tell, whether below is legal c++ or not ? template < typename s , s & (*fn) ( s * ) > class c {}; // partial specialization template < typename s , s & (*fn) ( s * ) > class c < s*, s* & (*fn)(s**) {}; g++ ( 4.2.4) error: a function call cannot appear in a constant-expression error: template argument 2 ...

When is OnValidate called in Linq?

I want to implement this partial method in my Linq table class. partial void OnValidate(System.Data.Linq.ChangeAction action); My hope is that is it called right before an insert. Can anyone tell me when the OnValidate method is called? Update 1 I understand that I can check the enum to see what action causes it to fire. But WHEN d...

ASP.NET partial page upload without Updatepanel /With jQuery

I have an ASPX page .In the Top i am displaying 5 categories (Ex : Pen,Book,Shoe,Mobile,Mirror) When i click on any of the categories,I want to show the products under that category below the header. I dont want to reload the entire page for this.I want to maintain my page as it is (The header,footer and side panels would ) when a click...

ASP MVC View Content as JSON

I have a MVC app with quite a few Controller Actions that are called using Ajax (jQuery) and return partial views content which updates a part of the screen. But what I would rather do is return JSON something like this. return Json(new { Result = true, Message = "Item has been saved", Content = View("Partial") }); Whe...

Should you only use local variables in a partial?

Using local variables seems advisable in a partial that could be used application-wide to avoid dependencies across the application. But within a single controller it seems acceptable to reference instance variables that you know will be available in all of the actions that use the partial. If you do this, there seems to be a risk, h...

Best Practices for using partials in Rails

In keeping with the DRY-principle I try to use partials as soon as I am repeating a particular pattern more than once or twice. As a result, some of my views consist of ten or more different partials. I am worried that this might have a negative effect on the overall performance. Some programming books compare the use of partials with th...

Binding Time in Partial Evaluation

What does exactly "Binding Time" mean when we are speaking about Partial Evaluation? ...