1
votes

I have successfully created and integrated successful user control in the Umbraco dashboard. 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. 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"]')

Is there a way to link from one user control to another within a custom dashboard control?

3

3 Answers

1
votes

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).

Just add your path to the following 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.

1
votes

iFrame option

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.

In this way you can go from .aspx to .aspx and still retain the dashboard tabs and surrounding design.

You will still need to add the folder that contains you .aspx pages to the umbracoReservedPaths entry in the web.config

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

Postback Option

Instead of trying to link between pages, why not just do all the work in the existing user control by using postbacks?

i.e. 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.