ModuleBuilder and selectedIndexChanged event
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>
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)
Any ideas?
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,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" %>
Is it correct ?
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;
Doesn't work either
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 ?
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,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 ?
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,