ShoppingCartItemSelector does not work with DataSource and Basic datalist/Basic repeater

   —   
If you add a ShoppingCartItemSelector to transformation used in the Basic datalist/Basic repeater which retrieves data from DataSource web parts it refreshes the page instead of redirecting to the shopping cart. The following instructions will help you to avoid this issue.
1. Clone the Basic datalist web part.

2. Open the cloned code (code behind), find the OnLoad method and add the following code at the begging:


protected override void OnLoad(EventArgs e)
{

// Reload data
if (RequestHelper.IsPostBack() && this.DataSourceControl != null)
{
LoadTransformations();
this.BasicDataList.DataSource = this.DataSourceControl.DataSource;
this.BasicDataList.DataBind();
binded = true;
}


plcBasicDataList.Controls.Add(this.BasicDataList);

//Handle filter change event
if (this.DataSourceControl != null)
{
this.DataSourceControl.OnFilterChanged += new ActionEventHandler(DataSourceControl_OnFilterChanged);
}

base.OnLoad(e);
}

If you use Basic repeater add the same code snippet to OnLoad method and exchange BasicDataList with BasicRepeater.
This bug will be fixed in the 5.5 version.


See also: DataSource documentation
ShoppingCartItemSelector documentation


Applies to: Kentico CMS 5.0
Share this article on   LinkedIn

Juraj Ondrus

Hi, I am the Technical support leader at Kentico. I'm here to help you use Kentico and get as much as possible out of it.