An ajax request is no different from any other request, so I dont
think that's true. Can you post some code (the controller, where the
call to GetMenu is made, and so on)
On Sat, Oct 25, 2008 at 2:50 AM, Martin Nilsson <[EMAIL PROTECTED]> wrote:
> 1. It seems that Controller.Context is not set when request is AJAX. Is
> there any way to get it? This means that I can't do this in GetMenu:
> var urlHelper = new UrlHelper(Context);
> var url = urlHelper.For(DictHelper.Create(new string[] {"controller=Foo",
> "action=index"}));
>
> 2. When I elaborated a little bit with the code in point 1 (in a none ajax
> contoller action) I saw that it takes the area name from _current_
> controller, which is different from area name for FooController. I'm
> thinking of doing something like this instead (but maybe there is already a
> way?):
>
> private static string UrlFor<T>(string action)
> where T : IController
> {
> var descriptor = ControllerInspectionUtil.Inspect(typeof (T));
> string url;
> if (string.IsNullOrEmpty(descriptor.Area))
> {
> url = string.Format("/{0}/{1}", descriptor.Name, action);
> }
> else
> {
> url = string.Format("/{0}/{1}/{2}", descriptor.Area, descriptor.Name,
> action);
> }
> return url;
> }
>
> What is the recommended way to build url's for controllers (with area, name
> and action)?
>
> /martin
>
>
>
>
> >
>
--
Cheers,
hammett
http://hammett.castleproject.org/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---