views:

76

answers:

1

I am using ASP.NET Dynamic Data to create a website that has two aspects - a public view, where data can only be viewed, and a admin site where all the CRUD operations happen. I want this to be a single DD website.

I have setup two routes:

    routes.Add(new DynamicDataRoute("admin/{table}/{action}.aspx")
    {
        Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
        Model = model
    });

and

    routes.Add(new DynamicDataRoute("{table}")
    {
        Action = PageAction.List,
        ViewName = "ListPublic",
        Model = model
    });

The problem is, when I view my public page, ListPublic (a copy of the original List.aspx), it works fine except the links to the related entity use the URL of admin/Suppliers/Details.aspx?SupplierId=1 ... when what I want them to point to is Suppliers/Details.aspx?SupplierId=1

How do I control how the URL is rendered out for the relationship in Dynamic Data?

Thanks in advance.

A: 

Ok, it turns out with a bit of googling I have helped myself. Seems there is actually a field template for this called ForeignKey.aspx which binds the URL to the value of GetNavigateUrl().

I guess my question now is:

  • What does GetNavigateUrl do?
  • What is the best approach to acheive my outcome of havnig a public and private website using dynamic data
Schneider