views:

723

answers:

3

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?

+1  A: 

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.

Tim Saunders
I've considered going this route too. But would rather figure out how to link to other controls as I may need to do so with future functionality.
JGrimm
Just a side note, but you cannot link between controls as they are not pages in their own right i.e. you can't link to myControl.ascx you have to link to page containing the control i.e MyPageContainingMyControl.aspx. This means the Link to page or iFrame options are the way forward.
Tim Saunders
All good points, Tim. I think I am going to go with this option for the time being.
JGrimm
+1  A: 

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.

Tim Saunders
+1  A: 

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" />
Tim Saunders