Create link to Sitecore Item

前端 未结 6 1884
Happy的楠姐
Happy的楠姐 2021-02-07 00:42

I know I have done this before but I can\'t seem to remember where or how.

I want to create a link to an Item in Sitecore. This code:

Sitecore.Data.Items         


        
6条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-07 01:19

    Your Web Control:

    
        Item
    
    

    Your Code:

    var homeItem = Sitecore.Context.Database.GetItem("/sitecore/content/Home");
    HyperLinkItem.NavigateUrl = Sitecore.Links.LinkManager.GetItemUrl(homeItem);
    

提交回复
热议问题