More in this section

Forums / Developing with Sitefinity / ModuleBuilder and selectedIndexChanged event

ModuleBuilder and selectedIndexChanged event

11 posts, 0 answered
  1. Elsane
    Elsane avatar
    30 posts
    Registered:
    06 Jan 2012
    02 Feb 2012
    Link to this post
    Hello,

    I'm trying to do something really simple :

    I created a content type "product" with the moduleBuilder and I'm trying to work on the listView. I need to do some actions when the user click on a an item but the selectedIndexChanged event seems not to be fired.

    My asp code :
    <telerik:RadListView ID="dynamicContentListView" ItemPlaceholderID="ItemsContainer"
                runat="server" OnSelectedIndexChanged="dynamicContentListView_SelectedIndexChanged"
                AllowSorting="true">
        <ItemTemplate>
            <asp:LinkButton ID="LinkButton1" CssClass="selectedButtons" runat="server" CommandName="Select">
                <%# Eval("Title") %> 
            </asp:LinkButton>
        </ItemTemplate>
        <SelectedItemTemplate>
            <asp:LinkButton ID="LinkButton2" CssClass="selectedButtons" runat="server" CommandName="Deselect">
              selected item
            </asp:LinkButton>
        </SelectedItemTemplate>
        <LayoutTemplate>
           <div class="asLayout">
              <asp:Panel ID="ItemsContainer" runat="server" />
           </div>
         </LayoutTemplate>
      </telerik:RadListView>

    Code Behind :
    namespace SitefinityWebApp.mods.Views
    {
        public partial class products_list : System.Web.UI.UserControl
        {
             
            protected void Page_Load(object sender, EventArgs e)
            {
            }
     
            protected void dynamicContentListView_SelectedIndexChanged(object sender, EventArgs e)
            {
            }
         }
    }

    A breakpoint in the page_load is triggered, but not in the dynamicContentListView_SelectedIndexChanged . Moreover the SelectedItemTemplate in the view is never used.

    I tried this code in a simple aspx page, all work fine. I must be missing something really simple. Any idea ?

    Thanks
  2. Elsane
    Elsane avatar
    30 posts
    Registered:
    06 Jan 2012
    03 Feb 2012
    Link to this post
    Any ideas?
  3. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    06 Feb 2012
    Link to this post
    Hi Elsane,

     Can you tell me how you mapped the template to your content widget? I see no bindings anywhere in the codebehind, so I assume you mapped this as a template, but how exactly did you do it? Thanks in advance for the cooperation.

    Kind regards,
    Svetoslav Petsov
    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. Elsane
    Elsane avatar
    30 posts
    Registered:
    06 Jan 2012
    06 Feb 2012
    Link to this post
    Hi,

    I created a page in which I inserted a content widget products.
    Next I edited  the list template of my widget. For the binding I modified the control language tag as :
    <%@ Control Language="C#" CodeBehind="products_list.ascx.cs" AutoEventWireup="true" Inherits="SitefinityWebApps.mods/Views.products_list" %>
  5. Elsane
    Elsane avatar
    30 posts
    Registered:
    06 Jan 2012
    07 Feb 2012
    Link to this post
    Is it correct ?
  6. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    09 Feb 2012
    Link to this post
    Hi Elsane,

     You can wire to the SelectedIndexChanged event from the codebehind (as the template is in the database and registering handlers from there wouldn't be working). Can you try this:

    protected void Page_Load(object sender, EventArgs e)
            {
                 
                this.ListView.SelectedIndexChanged += new EventHandler<EventArgs>(ListView_SelectedIndexChanged);
            }
     
            void ListView_SelectedIndexChanged(object sender, EventArgs e)
            {
                 
            }
     
            public RadListView ListView
            {
                get { return this.FindControl("dynamicContentListView") as RadListView; }
            }

    All the best,
    Svetoslav Petsov
    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
  7. Elsane
    Elsane avatar
    30 posts
    Registered:
    06 Jan 2012
    09 Feb 2012
    Link to this post
    Doesn't work either
  8. Elsane
    Elsane avatar
    30 posts
    Registered:
    06 Jan 2012
    10 Feb 2012
    Link to this post
    I send you a support ticket. Wiring to the SelectedIndexChanged event from the codebehind doesn't work either. Everythings work fine on my aspx pages. Do I miss something ?
  9. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    10 Feb 2012
    Link to this post
    Hello Elsane,

     I just spoke to our developers and it turns out that mapping external templates and adding logic to the ones in the database isn't possible in 4.4, as there are some implementations that need to be done, so that this can work. Mapping templates to the module builder widgets will appear as a feature in one of our future releases, but for now you won't be able to add any server-side logic to your template. The Page_Load event that you are hitting is actually the Page_Load event of the page (not the control) and since the template is already in the database, modifications on it won't be applied.

    Regards,
    Svetoslav Petsov
    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
  10. Elsane
    Elsane avatar
    30 posts
    Registered:
    06 Jan 2012
    10 Feb 2012
    Link to this post
    That's amazing !

    So what can be a workaround for that ? Are we obliged to pass throught an external aspx page to have such functionalities ?
  11. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    14 Feb 2012
    Link to this post
    Hi Elsane,

     There is no workaround for now. Soon, mapping of external templates for Module Builder modules would be available out-of-the-box, so you would be able to map your template and perform all the customizations that you need then.

    All the best,
    Svetoslav Petsov
    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
11 posts, 0 answered