Normaly, my node has a http://www.server.com/node.aspx url. But, for my "admin" users, I'd like to create in the backend a clickable link to http://www.server.com/node.aspx?altTemplate=Other_template. So, they don't have to remember the syntax, they just have to click from backend. Is it possible? I have a lot of nodes which should work like this, so I must be able to use something like niceurl.
Hi! I don't have Juno and I'm a Linux user... so I can't install visual studio! No mocking please :) I used to php and "notepad" edition. Is there a way I can do my datatype?
- Create the files below and put both in the /usercontrols directory - Change "altTemplateAlias" in the second file from "myAltTemplate" to whatever you want - Goto Developer -> DataTypes and create a new Datatype - Select umbraco usercontrol wrapper as the Render Control - Select AltTemplateLink.ascx from the usercontrol dropdown - Save - Add the new datatype to a doctype
Oh yeah, and get a Windows machine with Visual Studio :)
AltTemplateLink.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AltTemplateLink.ascx.cs" Inherits="AltTemplateLink" %> <asp:HyperLink ID="lnkAltTemplate" runat="server"></asp:HyperLink>
AltTemplateLink.ascx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using umbraco; using umbraco.editorControls;
public partial class AltTemplateLink : System.Web.UI.UserControl, umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor { string altTemplateAlias = "myAltTemplate"; string linkText = "Click Me";
display altTemplate in backend
Hi guys,
Normaly, my node has a http://www.server.com/node.aspx url. But, for my "admin" users, I'd like to create in the backend a clickable link to http://www.server.com/node.aspx?altTemplate=Other_template. So, they don't have to remember the syntax, they just have to click from backend. Is it possible? I have a lot of nodes which should work like this, so I must be able to use something like niceurl.
Thank you
Hi,
You'd have to make a custom datatype to do this, but it should be very easy...it won't even need to store any data.
You can use umbraco.library.NiceUrl to get the URL using the "id" querystring and append "?altTemplate=...." in the usercontrol.
If you're not familiar with this check out Tim's blog and/or umbraco.tv to get started. Let us know if any questions...
-Tom
I never created a custom datatype, I'll read Tim's blog. Thank you
Hi! I don't have Juno and I'm a Linux user... so I can't install visual studio! No mocking please :) I used to php and "notepad" edition. Is there a way I can do my datatype?
Hi
Today is your lucky day :)
- Create the files below and put both in the /usercontrols directory
- Change "altTemplateAlias" in the second file from "myAltTemplate" to whatever you want
- Goto Developer -> DataTypes and create a new Datatype
- Select umbraco usercontrol wrapper as the Render Control
- Select AltTemplateLink.ascx from the usercontrol dropdown
- Save
- Add the new datatype to a doctype
Oh yeah, and get a Windows machine with Visual Studio :)
AltTemplateLink.ascx
AltTemplateLink.ascx.cs
Wow!! Thanks a lot!! Now I have a better understanding of custom datatype and I now I can do that in notepad!
is working on a reply...