castle-monorail

Castle NVelocity Including Variables not Variable contents

I'm using Castles' NVelocity Engine to do some template work. Here's the problem. Several of my templates work fine, but one of them isn't. #foreach($i in $Items) <div class="grid_3 folioItem"> <a rel="prettyPhoto[portfolio]" href="$i.Link" class="lightBox"><img src="$i.Image" width="220" height="125" alt="showcase" /></a> <h4>$i.Sho...

Monorail parse URL to routing values

Is it possible to fire up nvelocity routing mechanism outside the context of request (standalone app, or a testing framework) and get an url from action and routing values from url? Here is a test, i need to figure out the routingMethod: var url = routingMethod.ResolveAction<MyController>(c=>c.MyAction("Foo",1)) Assert.AreEqual("/MyCon...

Extjs throws exception "realize was called with invalid remote-data" on successful creation of record

I am using extjs in a monorail application. I am using a JsonStore to persist data back to my controller. I have read, update and delete working properly. But I cannot seem to figure out how to format my response back on creates. Currently, Firebug gives me the following error: uncaught exception: Ext.data.DataReader: #realize was ...

.NET Hashtable - "Same" key, different hashes

Is it possible for two .net strings to have different hashes? I have a Hashtable with amongst others the key "path". When I loop through the elements in the table to print it, i can see that the key exists. When trying to looking it up however, there is no matching element. Debugging suggests that the string I'm looking for has a differ...

Entire monorail action invocation in tests

BaseControllerTest.PrepareController is enough for controller properties setup, such as PropertyBag and Context [TestClass] public ProjectsControllerTest : BaseControllerTest { [TestMethod] public void List() { // Setup var controller = new ProjectsController(); PrepareController(controller); controller.List(); // Asserts ...

Castle MonoRail ARDataBind trying to bind to non-existent row

I have a shopping cart application running on MonoRail and using Castle ActiveRecord/NHibernate, and there is a ShoppingCart table and a ShoppingCartItems table, which are mapped to entities. Here's the scenario: a user adds things to the shopping cart, say 5 items, and goes to view the cart. The cart shows all 5 items. the user du...

Unit testing Monorail's RenderText method

I'm doing some maintenance on an older web application written in Monorail v1.0.3. I want to unit test an action that uses RenderText(). How do I extract the content in my test? Reading from controller.Response.OutputStream doesn't work, since the response stream is either not setup properly in PrepareController(), or is closed in Ren...

Posting a form with a file attachment to a monorail controller

I have the following form (in brail): <form method="post" enctype="multipart/form-data" action="${UrlHelper.For({@action:'Upload'})}"> <p><b>Select Template:</b> &nbsp; <select id="template"> <option selected>Select One..</option> <option value="Research">Research</option> </select> </p> <br/> <p><b>Download Worksh...

How do you get the User's IP Address in Castle MVC (Monorail)?

In a controller action of a CastleMVC application, how can I get the user's IP Address? I think in asp.net mvc it would be Request.ServerVariables["REMOTE_ADDR"], but I can't find an equivalent in Castle. (I am aware of potential proxy issue's etc, the address that is reported in the request is fine) ...

MonoRail: Testing, Route Extensions, Folder Structures

I've got a few questions related to the use of MonoRail Testing Does everyone tend to use NUnit for their testing? I haven't worked enough with testing to know if this is a good testing framework to use. I'm just looking to get more into testing my applications a lot more than before and wanted to know if there's any general guideline...

Template in monorail ViewComponent

Is it possible to have a template with html content in vm for a block component? I'm doing a lot of stuff in html, and want the html reside in a .vm, not in codebehind. Here is what i've got: public class TwoColumn : ViewComponent { public override void Render() { RenderText(@" <div class='twoColumnLayout'> ...

Render ViewComponent from another component codebehind

I'm trying to render a component from withing another component. public override void Render() // ... var block = new Block(); block.Init(EngineContext, Context); block.Render(); // ... } The problem is that Block component can't find it's template. ResourceProcessingException Message: Unable to process resource 'componen...

How to create nested ViewComponents in Monorail and NVelocity?

I have been asked to update the menu on a website we maintain. The website uses Castle Windors Monorail and NVelocity as the template. The menu is currently rendered using custom made subclasses of ViewComponent, which render li elements. At the moment there is only one (horizontal) level, so the current mechanism is fine. I have bee...

Google web Toolkit with monorail

Well the topic says it all. Can I use google web toolkit to generate my views to be used in Castle Monorail project and render it through nvelocity view engine. Is it at all possible? ...

MonoRail - Select parent category from one dropdown, show child category dropdown

Hey, I'm new to MonoRail and am trying to figure out how to have it so that I can select a parent category in a dropdown then have it show a second dropdown with the categories that are children of the parent. If I were using what I'm used to, ASP.NET MVC, I would have a javascript function that would be called onchange of the first d...

MonoRail - How to write JavaScript within .vm page

I'm using MonoRail and tried to write a tag within a .vm view to write some JavaScript: <script type="text/javascript"> //<![CDATA[ $j(document).ready(function() { $j('#business_parentbusinesstype_id').change(function() { $j.ajax({ url:'http://localhost:88/admin/business/GetChildBusinessTypes', data: { parentId: $j('#bu...

MonoRail - how to call server-side method from jQuery

Hey, I'm trying to call a server-side action in a controller from jQuery: $.ajax({ url:'http://localhost:88/admin/business/11/GetChildBusinessTypes', data: { parentId: $('#business_parentbusinesstype_id').val() }, dataType: 'json', success: fillChildBusinessTypes, error: ajaxE...

MonoRail - Server-side vs. Client-side Form Validation

Hey, I'm using MonoRail and was wondering how it decides when to use client-side vs. server-side validation? In my model class I have [ValidateNonEmpty] on two properties, one is a textbox, the other is a dropdown. The textbox triggers client-side validation on form submission, if I leave the dropdown empty though it posts back to the s...

MonoRail - Clearing value on edit form submission doesn't trigger validation

Hey, In a MonoRail app I have an add/edit view. On add if I don't pick a value for a dropdown I get a validation error and am forced to pick a value. However, if I then edit that same item and reset the dropdown back to the first item ("Select an Item", "0"), it saves and doesn't say it was invalid. Debugging the entity sent back to the...

MonoRail - "Unexpected item on the stack" Error

Hey, Anyone seen this MonoRail error before and know what it means? Unexpected item on the stack: found UCampus.Core.Models.Nested.Hours, expecting UCampus.Core.Models.Business I'm saving a Business object when this error occurs, Hours is a child of a child of Business. Thanks, Justin ...