Using Button Selectors with Sitefinity 3.x

March 15, 2012
This one is really simple to implement, you can do it anywhere in Sitefinity.  It allows the designers to get a "select" button to find a library item or file and return the result back to a textbox

 

1) Make sure you register some of the Sitefinity control libraries in your web.config

<add tagPrefix="sf" namespace="Telerik.Libraries.WebControls" assembly="Telerik.Libraries" /> 
<add tagPrefix="sf" namespace="Telerik.Cms.Web.UI" assembly="Telerik.Cms.Web.UI" /> 
<add tagPrefix="sf" namespace="Telerik.Cms" assembly="Telerik.Cms" /> 

2) Add a Textbox to your control, then just simply link the AssociatedControl property of the <sf:ButtonSelector control to it

<asp:TextBox ID="mainImageTextBox" runat="server" Width="500px" /> 
<sf:ButtonSelector ID="imainImageSelector" runat="server" AssociatedControls="mainImageTextBox" /> 

 

So now when you load the page there will be a "Select" link beside your textbox that when clicked, opens the Library\File System selection Dialog.  Clicking Done on that dialog after choosing an item inserts the URL into the textbox automatically

TADA!



Image Description

Steve McNiven-Scott

Best\Only Blogger on this site. Therefore defacto blogger of the year Award Winner.