you should do this in the controller's action that got called before
rendering the view.if you need it on many actions, you should use a Filter
to set the value in the PropertyBag.

http://www.castleproject.org/monorail/documentation/trunk/usersguide/filters.html

<http://www.castleproject.org/monorail/documentation/trunk/usersguide/filters.html>

On Thu, Oct 15, 2009 at 9:56 AM, suneesh <[email protected]> wrote:

>
> Thanks Mauricio Scheffer for your reply,yes i understood.
> but in my case my problem is i need to get this value in my layout page
> (default.vm),
> then where can i placed the code PropertyBag["myKey"] =
> ConfigurationManager.AppSettings["myKey"];
> can i do it in Home controller(is it a  base controller?)?.
>
>
>
>
> On Oct 12, 10:21 pm, Mauricio Scheffer <[email protected]>
> wrote:
> > IMHO you should keep nvelocity templates as dumb as possible.
> > If you're using MonoRail, you can just do PropertyBag["myKey"] =
> > ConfigurationManager.AppSettings["myKey"];
> > If you're using plain stand-alone NVelocity, pass the value through
> > the VelocityContext.
> >
> > On Oct 12, 1:34 pm, suneesh <[email protected]> wrote:
> >
> > > This must be a simple question.
> >
> > > My question is how to get the <appSettings> value: myValue in the
> > > web.config:
> >
> > >   <appSettings>
> > >     <add key="myKey" value="myValue" />
> > >   </appSettings>
> >
> > >  in .vm  file similar to "<%$appSettings:myKey %>" in aspx file
> >
> > > I know in .cs we can get it from:
> >
> > > System.Configuration.ConfigurationManager.AppSettings["myKey"]
> >
> > > but don't know how in .vm.
> >
> > > Thanks.
> >
>


-- 
Ken Egozi.
http://www.kenegozi.com/blog
http://www.delver.com
http://www.musicglue.com
http://www.castleproject.org
http://www.idcc.co.il - הכנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to