Custom property rendered as a link in edit mode, how do it in CMS 5?

Vote:
 

Hi

We have a solution built in 4.31 that we are upgrading to CMS 5.

In our old solution we have a custom property that render a link in edit mode. When a web editor click the link he/she gets a new window with an external web application, with some pameters from the page that the web editor is currently editing.

ie. we do not want the web editor to fill in any data in edit mode for our custom property field. They only gets a link.

In 4.31 we managed to do this with the code snippet at the bottom. How do we do it in CMS 5. I´ve searched but not found any solution. There are only solutions to how to get ordinary input fields like textbox, radiobutton, dropdownlists and so on.

public override void CreateChildControls(string RenderType, System.Web.UI.Control Container) { switch (RenderType.ToLower()) { case "edit": System.Web.UI.WebControls.HyperLink representantHyperLink = new System.Web.UI.WebControls.HyperLink(); representantHyperLink.ID = Name; representantHyperLink.Text = "Administrera representanter";
representantHyperLink.NavigateUrl = pageURLProperty.ToString() + "?page=representantA"; representantHyperLink.Target = "_blank"; CopyWebAttributes(Container, representantHyperLink); Container.Controls.Add(representantHyperLink); break; default: base.CreateChildControls(RenderType, Container); break; } }
 
#19629
Apr 22, 2008 8:18
Vote:
 

Hi!

Just create a property control that inherrits from PropertyDataControl and implement the CreateEditControls method to add your edit controls to the control collection. You need to create a property class as well that points out your property control in EPiServer CMS as we have splitted presentation logic from the data logic. See the "How to Create a Custom Property" guide in the sdk for a brief walk through.

Linus Ekström
EPiServer Development Team

#19700
Apr 28, 2008 14:34
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.