简体   繁体   English

Umbraco:后端用户控制

[英]Umbraco: Backend User Control

I have successfully created and integrated successful user control in the Umbraco dashboard. 我已经在Umbraco仪表板中成功创建并集成了成功的用户控件。 The page begins with a search control that returns a list of editable items. 该页面以搜索控件开始,该控件返回可编辑项目的列表。

In my user control I am having issues with directing the link for the edit page. 在我的用户控件中,我无法直接指向编辑页面的链接。 I'm trying to link directly to it. 我正在尝试直接链接到它。 Here's that code: 这是代码:

<asp:hyperlinkfield
    datanavigateurlformatstring="/usercontrols/useradmin/item_edit.aspx?itemID={0}"
    datanavigateurlfields="itemID" Text="edit" />

Umbraco is unable to handle the direct link and I'm not sure how to path to it. Umbraco无法处理直接链接,因此我不确定如何建立链接。 Instead it returns this error: 而是返回此错误:

No umbraco document matches the url ' http://localhost:1169/usercontrols/useradmin/item_edit.aspx?itemID=f66c8f06-9e0e-4f3c-ac0d-5544e0998094 ' umbraco tried this to match it using this xpath query'/root/node/node [@urlName = "usercontrols"]/node [@urlName = "useradmin"]/node [@urlName = "item_edit"]') 没有umbraco文档与url'http:// localhost:1169 / usercontrols / useradmin / item_edit.aspx?itemID = f66c8f06-9e0e-4f3c-ac0d-5544e0998094 '匹配umbraco尝试使用此xpath查询匹配它'/ root / node / node [@urlName =“ usercontrols”] / node [@urlName =“ useradmin”] / node [@urlName =“ item_edit”]')

Is there a way to link from one user control to another within a custom dashboard control? 有没有一种方法可以将一个用户控件链接到自定义仪表板控件中的另一个控件?

Postback Option 回发选项

Instead of trying to link between pages, why not just do all the work in the existing user control by using postbacks? 除了尝试在页面之间链接之外,为什么不使用回发在现有用户控件中进行所有工作呢?

ie a method like this in your user control 即在您的用户控件中这样的方法

public void Handle_Click(object sender, System.Event args)
{
    //Do Something
}

This will work correctly as umbraco will not try and interpret the URL as it's staying on the same page. 由于umbraco不会停留在同一页面上,因此它不会尝试解释该URL,因此可以正常工作。

Link to page option 链接到页面选项

To enable linking to another page you will need to add an entry in the web.config file telling umbraco to ignore the path (so it doesn't try and interpret the URL). 要启用链接到另一个页面,您需要在web.config文件中添加一个条目,告诉umbraco忽略该路径(因此它不会尝试解释URL)。

Just add your path to the following appSetting: 只需将您的路径添加到以下appSetting中即可:

<add key="umbracoReservedPaths" value="/umbraco,/install,/YOUR/PATH/HERE" />

The link will then work in the dashboard control, however it will link to a page that doesn't have all the dashboard design applied (so the tabs will disappear etc). 该链接随后将在仪表板控件中起作用,但是它将链接到未应用所​​有仪表板设计的页面(因此选项卡将消失,等等)。 You can apply the design to your .aspx page, however it is quite a bit of work. 您可以将设计应用到您的.aspx页面,但是这需要很多工作。

iFrame option iFrame选项

Because of the limitations as described in the Link to page option you may wish to load your admin pages into an iFrame which you put on the .ascx control. 由于“链接到页面”选项中所述的限制,您可能希望将管理页面加载到放置在.ascx控件上的iFrame中。

In this way you can go from .aspx to .aspx and still retain the dashboard tabs and surrounding design. 这样,您可以从.aspx转到.aspx,并且仍然保留仪表板选项卡和周围的设计。

You will still need to add the folder that contains you .aspx pages to the umbracoReservedPaths entry in the web.config 您仍然需要将包含.aspx页的文件夹添加到web.config中的umbracoReservedPaths条目中

<add key="umbracoReservedPaths" value="/umbraco,/install,/YOUR/PATH/HERE" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM