ModuleBuilder and selectedIndexChanged event

Posted by Community Admin on 04-Aug-2018 11:03

ModuleBuilder and selectedIndexChanged event

All Replies

Posted by Community Admin on 02-Feb-2012 00:00

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

Posted by Community Admin on 03-Feb-2012 00:00

Any ideas?

Posted by Community Admin on 06-Feb-2012 00:00

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

Posted by Community Admin on 06-Feb-2012 00:00

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" %>

Posted by Community Admin on 07-Feb-2012 00:00

Is it correct ?

Posted by Community Admin on 09-Feb-2012 00:00

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

Posted by Community Admin on 09-Feb-2012 00:00

Doesn't work either

Posted by Community Admin on 10-Feb-2012 00:00

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 ?

Posted by Community Admin on 10-Feb-2012 00:00

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

Posted by Community Admin on 10-Feb-2012 00:00

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 ?

Posted by Community Admin on 14-Feb-2012 00:00

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

This thread is closed