1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Widget in a tempalte

Widget in a tempalte

6 posts, 0 answered
  1. Mark
    Mark avatar
    6 posts
    Registered:
    31 Oct 2010
    12 Jul 2011
    Link to this post
    Hi

    Quick question, can you add a Widget to a Page Template? If i wanted to add an image gallery widget to a news template can i just write something like <sf:imagegallery album="stuff"  runat="server" />?

    I am guessing its not that easy although I have no understanding of why it would not be that easy.

    Thanks
  2. Mark
    Mark avatar
    6 posts
    Registered:
    31 Oct 2010
    14 Jul 2011
    Link to this post
    Bump
  3. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    14 Jul 2011
    Link to this post
    Hello Mark,

    Can you please elaborate a little bit on the exact use case scenario you want to apply - do you want to add a widget to a Page template or to a Widget template? Adding widgets to a page template is a functionality that we're providing out of the box, so my guess is you want the second functionality implemented. It's also not a problem, however our widgets are complex controls so if you want to mimic the same look and functionality you'll have to refer to the specific template, besides that the implementation should be the same as a adding any control to a template. If it's the concrete scenario (image gallery to news item) I believe a better approach would be to add an image selector as a custom field to your News module and then display the thumbnails/images associated with a particular news item in its template. Please find detailed instructions on implementing this in the following blog post.

    All the best,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Mark
    Mark avatar
    6 posts
    Registered:
    31 Oct 2010
    14 Jul 2011
    Link to this post
    Thanks for the reply.

    I want to open a Page Template, say Single News Item. Then add a line of code that embeds a widget, say the gallery image. is it as simple as adding a reference to the widget i.e. <sf:widgetname runat="server" id="mywidget" />. If this is supported out of the box is there a list of widgets and the corresponding in-line code I would need to use or a guide to adding sitefinity widgets to Page Templates? 
  5. Mark
    Mark avatar
    6 posts
    Registered:
    31 Oct 2010
    18 Jul 2011
    Link to this post
    bump
  6. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    19 Jul 2011
    Link to this post
    Hello Mark,

    Actually, I believe we are talking about the  Widget templates in Sitefinity, not the Page templates, eight? If so, yes, it's still possible to add another widget in a widget template, however it has to be an external template, not the embedded ones that you can edit from the widget's settings. To achieve this functionality you can create a folder ControlTemplates in your Sitefnity project and add a new user control there. The you can register a tag prefix to include the assembly the desired control is located in. Once you've created the template you can take a look at this article which explains how to map the external template to the widget in Sitefinity. Please find below an example on how to create a simple template that uses the ImageField public control:
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="SitefinityWebApp.Controls.WebUserControl1" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
     
    <sitefinity:ImageField ID="ImageField1" runat="server" ImageId="enter image id here"></sitefinity:ImageField>


    Greetings,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
6 posts, 0 answered