Admin -> Browse Catalog -> Choose Operation -> Error

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
Diavan
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Mon Dec 14, 2009 11:38 pm

Admin -> Browse Catalog -> Choose Operation -> Error

Post by Diavan » Sat Apr 17, 2010 12:51 am

Under "Admin -> Browse Catalog" (Browse.aspx) if any Category contains products count more than GridView PageSize (default=40) than the paging links will show up on top and bottom for that category.
If you navigate to any page above Page '1' - then select any number of products using the checkboxes - after that try to use any bulk operation from dropdown (<choose operation>) - I get error every time on the code below.
Can someone confirm this please. Many thanks.

Code: Select all

protected List<DataKey> GetSelectedItems()
{

	List<DataKey> selectedItems = new List<DataKey>();
	foreach (GridViewRow row in CGrid.Rows)
	{
		CheckBox selected = (CheckBox)PageHelper.RecursiveFindControl(row, "Selected");
		if ((selected != null) && selected.Checked)
		{
			int index = row.DataItemIndex - (CGrid.PageIndex * CGrid.PageSize);
			selectedItems.Add(CGrid.DataKeys[index]);   // *ERROR* - index always negative for page '2' and above
		}
	}
	return selectedItems;
}
However .... it works with a little change.

Code: Select all

protected List<DataKey> GetSelectedItems()
{

	List<DataKey> selectedItems = new List<DataKey>();
	foreach (GridViewRow row in CGrid.Rows)
	{
		CheckBox selected = (CheckBox)PageHelper.RecursiveFindControl(row, "Selected");
		if ((selected != null) && selected.Checked)
		{
			int index = row.DataItemIndex; // - (CGrid.PageIndex * CGrid.PageSize);
			selectedItems.Add(CGrid.DataKeys[index]);   // *WORKS*
		}
	}
	return selectedItems;
}

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Admin -> Browse Catalog -> Choose Operation -> Error

Post by jmestep » Sat Apr 17, 2010 8:30 am

There is a bug and mazhar posted a quick fix for it:
viewtopic.php?f=42&t=13091
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

Post Reply