Search Results

Search found 1976 results on 80 pages for 'helper'.

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

  • Guidelines for calling controller methods in helper modules?

    - by keruilin
    Few questions: Is it possible to call a controller method in a helper module (e.g., application helper)? If so, how does the helper handle the rendering of views? Ignore it? In what instances would you want to call a controller method from a helper? Is it bad practice? Do you have any sample code where you're calling controller methods in helper?

    Read the article

  • Calling helper function in Evaluate/Modify (Ctrl+F7) window

    - by m0f0
    Lets say i wrote helper for TStringList TslHelper = class helper for TStringList function DoSth: boolean; end; Then ive included this helper (unit in which helper is defined) in unit i want to use it. During debugging i hit Ctrl+F7 and i want to evaluate: someStringList.DoSth I cant get it to work. Is it possible? Regards

    Read the article

  • How do I code a MVC3 Helper

    - by Mike Clarke
    I’ve just build my first Helper in MVC, it’s very basic and just displays a string where ever I use it. So it’s a .cshtml file in my App_Code folder, I think that is how it's supposed to be set up, with the following code in it, @helper DisplaySelect() { @:This text is coming from an helper class. } Now I am a wiz with helpers how do I make it do things. E.g.. say I want it to query the database and display something, I would normally do that work in my controller. How do I do that with helpers, do I create a helper controller and then treat the helper like a partial view??? Any help would be greatly appreciated. Cheers, Mike.

    Read the article

  • Using a helper method in a mailer that is defined in a controller

    - by Horace Loeb
    The helper method current_user is defined and made available as a helper in ApplicationController like this: class ApplicationController < ActionController::Base helper_method :current_user def current_user return @current_user if defined?(@current_user) @current_user = current_user_session && current_user_session.record end end My question is how I can use the current_user helper method in a mailer template (obviously it will always return nil, but I'm trying to render a partial that depends on it). Normally when I want to use helpers in a mailer, I do something like add_template_helper(SongsHelper), but since the helper is defined in a class instead of a module I'm not sure what to do

    Read the article

  • My helper methods in controller

    - by FancyDancy
    My app should render html, to answer when a user clicks ajax-link. My controller: def create_user @user = User.new(params) if @user.save status = 'success' link = link_to_profile(@user) #it's my custom helper in Application_Helper.rb else status = 'error' link = nil end render :json => {:status => status, :link => link} end My helper: def link_to_profile(user) link = link_to(user.login, {:controller => "users", :action => "profile", :id => user.login}, :class => "profile-link") return(image_tag("/images/users/profile.png") + " " + link) end I have tried such methods: ApplicationController.helpers.link_to_profile(@user) # It raises: NoMethodError (undefined method `url_for' for nil:NilClass) and: class Helper include Singleton include ApplicationHelper include ActionView::Helpers::TextHelper include ActionView::Helpers::UrlHelper include ApplicationHelper end def help Helper.instance end help.link_to_profile(@user) # It also raises: NoMethodError (undefined method `url_for' for nil:NilClass) In addition, yes, I KNOW about :helper_method, and it works, but i don't want to overload my ApplicationController with a plenty of that methods

    Read the article

  • Another question about ASP.NET MVC and a separate project for helper classes

    - by rockinthesixstring
    I know this topic has been discussed to death, but there is one thing that I can't wrap my head around. I'm working on a Web Application using ASP.NET MVC and I come across a scenario where I need a helper class (this usually happens in the early stages of development. So I go ahead and create a helper project in my solution that I use to manage all of my Helper Classes. Now, do I have to build that project and dump the dll in the bin directory every time I make changes to is, or is there a way to have the main web application reference the classes contained within the separate project without the separate build process? I'm just looking for the easiest way to add helper classes without the hastel of building and moving the dll every time I make a change or addition. Also, sorry for the very newbie-esque question here. All of the web apps I've build in the past have all been in the same project (web forms, App_Code, etc).

    Read the article

  • Zend Controller Action Helper Problem not able to add helper

    - by snakeyyy
    Trying to make a controller helper to have similar functionality in some controllers using the preDispatch method. Error: Fatal error: Class 'Helper_Action_Test' not found in /var/www/zend.dev/application/Bootstrap.php on line 9` Application layout /Application /Helpers **/Actions** this is where i will save the classes /Views /modules /configs /layouts /Bootstrap.php In the Bootstrap I have added: protected function _initActionHelpers(){ Zend_Controller_Action_HelperBroker::addHelper(new Helper_Action_Test()); } In the helper file I have: class Helper_Action_Test extends Zend_Controller_Action_Helper_Abstract{ public function preDispatch() { echo 'Test'; } } Any ideas?

    Read the article

  • Port a live system from App Engine Helper to App Engine Patch

    - by Alexander
    I am running a live system that is currently serving about 20K pages a day which is based on App Engine Helper (Python) with session support provided by AppEngine utilities. One problem that I have been having is that sessions are occasionally randomly logging out. I would like to try using the App Engine Patch, since it has "native" django session support, but I am worried that this is possibly going to be like doing a brain transplant. Specifically, current database models are all inhereted from BaseModel provided by the App Engine Helper. While, App Engine Patch does not have this inheritance. Does anyone know if it is possible to migrate a live system from App Engine Helper to App Engine Patch? If so, do you have any advice or warnings that I should heed, before attempting this transition? Thank you and kind regards Alex

    Read the article

  • CodeIgniter helper inside controllers

    - by kapitanluffy
    can i call helper functions inside controller classes? let's say i have this controller with the _open_form method class User extends Controller { function _open_form($action){ print_r(form_open($action)); } } i tried echoing out the result of form_open() but it returns null. it seems that helper functions can't be called inside controllers if your wondering why i need to use it inside the controller instead in the view because we are required to use the given template parser xD

    Read the article

  • WebGrid Helper and Complex Types

    - by imran_ku07
        Introduction:           WebGrid helper makes it very easy to show tabular data. It was originally designed for ASP.NET Web Pages(WebMatrix) to display, edit, page and sort tabular data but you can also use this helper in ASP.NET Web Forms and ASP.NET MVC. When using this helper, sometimes you may run into a problem if you use complex types in this helper. In this article, I will show you how you can use complex types in WebGrid helper.       Description:             Let's say you need to show the employee data and you have the following classes,   public class Employee { public string Name { get; set; } public Address Address { get; set; } public List<string> ContactNumbers { get; set; } } public class Address { public string City { get; set; } }               The Employee class contain a Name, an Address and list of ContactNumbers. You may think that you can easily show City in WebGrid using Address.City, but no. The WebGrid helper will throw an exception at runtime if any Address property is null in the Employee list. Also, you cannot directly show ContactNumbers property. The easiest way to show these properties is to add some additional properties,   public Address NotNullableAddress { get { return Address ?? new Address(); } } public string Contacts { get { return string.Join("; ",ContactNumbers); } }               Now you can easily use these properties in WebGrid. Here is the complete code of this example,  @functions{ public class Employee { public Employee(){ ContactNumbers = new List<string>(); } public string Name { get; set; } public Address Address { get; set; } public List<string> ContactNumbers { get; set; } public Address NotNullableAddress { get { return Address ?? new Address(); } } public string Contacts { get { return string.Join("; ",ContactNumbers); } } } public class Address { public string City { get; set; } } } @{ var myClasses = new List<Employee>{ new Employee { Name="A" , Address = new Address{ City="AA" }, ContactNumbers = new List<string>{"021-216452","9231425651"}}, new Employee { Name="C" , Address = new Address{ City="CC" }}, new Employee { Name="D" , ContactNumbers = new List<string>{"045-14512125","21531212121"}} }; var grid = new WebGrid(source: myClasses); } @grid.GetHtml(columns: grid.Columns( grid.Column("NotNullableAddress.City", header: "City"), grid.Column("Name"), grid.Column("Contacts")))                    Summary:           You can use WebGrid helper to show tabular data in ASP.NET MVC, ASP.NET Web Forms and  ASP.NET Web Pages. Using this helper, you can also show complex types in the grid. In this article, I showed you how you use complex types with WebGrid helper. Hopefully you will enjoy this article too.  

    Read the article

  • Call asp.net mvc Html Helper within custom html helper with expression parameter

    - by Frank Michael Kraft
    I am trying to write an html helper extension within the asp.net mvc framework. public static MvcHtmlString PlatformNumericTextBoxFor<TModel>(this HtmlHelper instance, TModel model, Expression<Func<TModel,double>> selector) where TModel : TableServiceEntity { var viewModel = new PlatformNumericTextBox(); var func = selector.Compile(); MemberExpression memExpession = (MemberExpression)selector.Body; string name = memExpession.Member.Name; var message = instance.ValidationMessageFor<TModel, double>(selector); viewModel.name = name; viewModel.value = func(model); viewModel.validationMessage = String.Empty; var result = instance.Partial(typeof(PlatformNumericTextBox).Name, viewModel); return result; } The line var message = instance.ValidationMessageFor<TModel, double>(selector); has a syntax error. But I do not understand it. The error is: Fehler 2 "System.Web.Mvc.HtmlHelper" enthält keine Definition für "ValidationMessageFor", und die Überladung der optimalen Erweiterungsmethode "System.Web.Mvc.Html.ValidationExtensions.ValidationMessageFor(System.Web.Mvc.HtmlHelper, System.Linq.Expressions.Expression)" weist einige ungültige Argumente auf. C:\Projects\WorkstreamPlatform\WorkstreamPlatform_WebRole\Extensions\PlatformHtmlHelpersExtensions.cs 97 27 WorkstreamPlatform_WebRole So according to the message, the parameter is invalid. But the method is actually declared like this: public static MvcHtmlString ValidationMessageFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression); So actually it should work.

    Read the article

  • What's the convention for extending Linq with set based helper operations

    - by Luke Rohde
    Hi All I might be vaguing out here but I'm looking for a nice place to put set based helper operations in linq so I can do things like; db.Selections.ClearTemporary() which does something like db.DeleteAllOnSubmit(db.Selections.Where(s => s.Temporary)) Since I can figure out how to extend Table<Selection> the best I can do is create a static method in partial class of Selection (similar to Ruby) but I have to pass in the datacontext like; Selection.ClearTemporary(MyDataContext) This kind of sucks because I have two conventions for doing set based operations and I have to pass the data context to the static class. I've seen other people recommending piling helper methods into a partial of the datacontext like; myDataContext.ClearTemporarySelections(); But I feel this makes the dc a dumping ground for in-cohesive operations. Surely I'm missing something. I hope so. What's the convention? TIA

    Read the article

  • What's the convention for extending Linq datacontext with set based helper operations specific to on

    - by Luke Rohde
    Hi All I might be vaguing out here but I'm looking for a nice place to put set based helper operations in linq so I can do things like; db.Selections.ClearTemporary() which does something like db.DeleteAllOnSubmit(db.Selections.Where(s => s.Temporary)) Since I can figure out how to extend Table<Selection> the best I can do is create a static method in partial class of Selection (similar to Ruby) but I have to pass in the datacontext like; Selection.ClearTemporary(MyDataContext) This kind of sucks because I have two conventions for doing set based operations and I have to pass the data context to the static class. I've seen other people recommending piling helper methods into a partial of the datacontext like; myDataContext.ClearTemporarySelections(); But I feel this makes the dc a dumping ground for in-cohesive operations. Surely I'm missing something. I hope so. What's the convention? TIA

    Read the article

  • Not see my view helper

    - by Alexandr
    I create my view helper it located in /library/My/View/helpers/SpecialPurpose.php the class name is My_View_Helper_SpecialPurpose it have public function specialPurpose() it return some HTML i register this path in bootstrap.php $view = Zend_Layout::getMvcInstance()-getView(); $view-addBasePath('/my/view/helpers',"My_View_Helper"); when i tring specialPurpose();? in any view .phtml it trow exeption Message: Plugin by name 'SpecialPurpose' was not found in the registry; used paths: My_View_Helper_Helper_: /my/view/helpers\helpers/ Zend_View_Helper_: Zend/View/Helper/;D:/WWW/zends/application/modules/default/views\helpers/ P.S I read many post in stackoverflow but not one solutions not helped If it possible weácan how do this task with bootstrap and application.ini zf version 1.10.3

    Read the article

  • Are there any drawbacks to using helper :all in Rails

    - by Rob Jones
    In Rails 'helper :all' makes all your helpers 'available' to all your controllers. This is concise and convenient, but does it have any memory and/or performance implications compared to explicitly calling the helpers that each controller actually needs? It's unclear form the docs whether using it involves 'require'ing all those files, or whether autoload is being used. I can't tell from the source in the Rails framework docs. thanks

    Read the article

  • Rails helper, show word not date.

    - by dannymcc
    Hi Everyone, A follow on from this questions: http://stackoverflow.com/questions/3032598/rails-created-at-on-display-if-today Is it possible to output the word TODAY rather than the date when using the following helper? def created_today k k.created_at if k.created_at.to_date == Date.today end <%=h created_today(k) %> Thanks, Danny

    Read the article

  • Html helper to show display name attribute without label

    - by Pedre
    I have this: [Display(Name = "Empresa")] public string Company{ get; set; } In my aspx I have: <th><%: Html.LabelFor(model => model.Company)%></th> And this generates: <th><label for="Company">Empresa</label></th> Are there any html helper extensions to only show the display attribute without label, only plain text? My desired output is this: <th>Empresa</th> Thanks! EDIT I tried DisplayFor or DisplayTextFor as suggested, but they are not valid because they generate: <th>Amazon</th> They return the value of the property... I want the name from the Display attribute.

    Read the article

  • VLC helper protocol on Mac OS X

    - by Preben
    Hey everybody, I am trying to add a vlc:// helper protocol on Mac OS X. To register the protocol, I have unsuccessfully been playing around with the MoreInternet PrefPane. What I want to have in my browser is a vlc://someressource.com/audio.mp3, which should launch VLC and add http://someressource.com/audio.mp3 to the playlist (this works fine on Windows and also Linux if I remember correctly). Maybe even just have vlc://http:// so that https would also be supported. I have no idea how to achieve this. I tried making a bash script, which MoreInternet would not accept. Then I tried making an application through Automator with my Bash script embedded. That did not work either, as the Automator application has no "creator code" - whatever that is?! Can any of you guys point me in the right direction? Thanks in advance!

    Read the article

  • External GUI/Helper Library for Visual C++?

    - by Psychic
    I am looking for some kind of library, either open source or bought in, that provides advanced GUI components, helper functions & classes etc. It needs to be something that integrates relatively easily into Visual Studio, and should be based around C++ and Windows. Cross platform isn't needed, and can somtimes make things a little more complex and restricted than single platform, but it is still acceptable. It also needs to be up-to-date and active. There appears to be a number of 'retired' libraries that offer little or no support, so these would not be suitable, as I'm going to need help every now and then! It also needs good documentation. I know about wxWidgets but I'm wondering what other alternatives there are? At first glance, wxWidgets doesn't strike me as what I want/need, especially in the GUI area where the visual components seem striking similar to the stock components. I want more custimization! Is there much out there that meets these requirements?

    Read the article

  • Nullable enum in html helper

    - by Fabien Piron
    I have a view model that contains enum with nullable type like this one : public StudyLevel? studyLevel { get; set; } I have made custom html helper to display a dropdownlist for rendering the enum into the view, the nullable case is displayed using <option value="null">No value</option> the problem is that when i submit the form modelstate give me the error : studylevel cannot be "null" . Could you suggest me any way to help me handle the nullable type in the view ?

    Read the article

  • Problem using js jquery helper

    - by Josh R
    hi, I am using cakephp 1.3.6 and am trying to use inbuilt js helper. I have added var $helpers = array('Js' => array('Jquery')); in my controller. In my layout, I have included the jquery files and have also included echo $this->Js->writeBuffer(); before the </body> tag. I checked if the jquery libraries correctly but trying to create a simple accordian from the jqueryui.com, it works fine. But when I try <?php $this->Js->get('#element'); $this->Js->drag(array( 'container' => '#content', 'start' => 'onStart', 'drag' => 'onDrag', 'stop' => 'onStop', 'snapGrid' => array(10, 10), 'wrapCallbacks' => false )); ?> <div="element">something</div> It does not work. I appreciate any help. Thanks.

    Read the article

  • Boolean with html helper Hidden and HiddenFor

    - by Martin
    What's up with this? The viewmodel variable is a bool with value true. <%= Html.HiddenFor(m => m.TheBool) %> <%= Html.Hidden("IsTimeExpanded",Model.TheBool) %> <input type="hidden" value="<%=Model.TheBool%>" name="TheBool" id="TheBool"> Results in: <input id="TheBool" name="TheBool" value="False" type="hidden"> <input id="TheBool" name="TheBool" value="False" type="hidden"> <input value="True" name="TheBool" id="TheBool" type="hidden"> What am I doing wrong? Why don't the helpers work as intended?

    Read the article

  • Searching for known Team Development helper tools

    - by John
    Hello, My team is small, only two programmers.We both share one source ,but we live in different places.The problem is that Meanwhile I make changes on our project,the other team worker makes changes as well.It's very hard to write down every change,at least for us. When we decide we've made an important change,we contact each other sending the whole project's source. This is not good,because: The files sent from one do not contain the changes that the other worker has been working on meanwhile. We host the source on free servers,thus makes it possible for other to see the files.It will be VERY much better if only few(those that are changed) files are being uploaded rather than the whole project. My question: Are there any tools that could make our lives easier? Thanks in advance! EDIT: We use Delphi 2009.

    Read the article

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