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

Forums / Developing with Sitefinity / Dynamic Module Widget Template: Access data items list from code behind

Dynamic Module Widget Template: Access data items list from code behind

3 posts, 0 answered
  1. Eduardo
    Eduardo avatar
    3 posts
    Registered:
    10 Dec 2013
    25 Jul 2014
    Link to this post

    Hello everyone,

    I'm new to Sitefinity and .NET C# development and I think I'm doing some things the wrong way.

    I have a custom dynamic module, which has a custom Widget Template for its default Widget. This Widget Template has a codebehind file which looks like this:

    namespace SitefinityWebApp.Custom.WidgetTemplates.ExtranetImages
    {
      public partial class ExtranetImagesThumbnails : System.Web.UI.UserControl
      {
      }
    }

    I'm filtering items according to some dropdowns by getting a filtered list of items and binding them to the RadListView controller with id "dynamicContentListView". One problem is that this RadListView is already filled in by the default widget controller, so I'm doing it twice.

    The second problem is that I would like to keep any filters that might be already setup by the user in the widget parameters, but right now I'm losing them when I get the items based on the dropdowns values.

    My question is: Which is the right approach? How can I avoid to load the items twice? How can I get the items before they are binded to the RadListView so I can filter them?

    Thanks a lot!

     

     

    1.namespace SitefinityWebApp.Custom.WidgetTemplates.ExtranetImages
    2.{
    3.  public partial class ExtranetImagesThumbnails : System.Web.UI.UserControl
    4.  {
    5.  }
    6.}
  2. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    30 Jul 2014
    Link to this post
    Hello Eduardo,

    I suspect you have extended the template by adding the following in your template:
    <%@ Control Language="C#" Inherits="SitefinityWebApp.Custom.WidgetTemplates.ExtranetImages.ExtranetImagesThumbnails"%>

    Actually by doing the above you are extending the build-in functionality, but you rather need to override it, so the above approach will not help.

    I could suggest you to read Boyan Barnev`s blogpost, where is explained how to filter items in a custom template and bind them to a RadComboBox: Filtering Sitefinity ContentView-based Controls on the Frontend

    Hope this helps.

    Regards,
    Vassil Vassilev
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Eduardo
    Eduardo avatar
    3 posts
    Registered:
    10 Dec 2013
    30 Jul 2014
    Link to this post

    It was very helpful indeed, thank you!

    I got it working the way I wanted thanks to this post too:

    http://www.sitefinity.com/blogs/boyan-barnevs-blog/boyan-barnevs-posts/boyan-barnevs-blog-/2014/04/15/replacing-a-default-view-of-a-sitefintiy-contentview-based-widget

3 posts, 0 answered