質問

A bit new to Umbraco, so this might be a bit of a scattered question.

I'm using 5.1.

I have a document type called Auction with a selected Template called Auction Details

My end goal is to call this controller method on my AuctionSurfaceController

    [ChildActionOnly]
    public PartialViewResult Detail(string id)
    {
        Guid auctionId;
        if (Guid.TryParse(id, out auctionId))
        {
            var auction = auctionService.Client.GetAuction(auctionId);
            return PartialView(auction);
        }
        return null;
    }

As of this moment when I go to /Auction - it hits this method and passes in "Auction" into the method, when I go to /Auction/{GUID} i just get a 404

Could I please get some general guidance - or requests for clarifications on how to accomplish this. I would very much appreciate it

Cheers!

役に立ちましたか?

解決

It sounds like the routing is working properly.

Assuming that you're executing from the context of being on an 'auction detail' page, it would then make sense that /{GUID} would serve as the id parameter. (rather than www.mysite.com/auctions/auction/id)

Sometimes this question comes up because there's more than one form on a page, and it's difficult to figure out how umbraco will know which controller Umbraco will post to. This is where the bind attribute comes into play.

However, if you want to use custom routing, because Umbraco 5 is built on MVC, you can always create your own areas and controllers.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top