Asp.Net listview with asp:datapager

Asp.Net listview with asp:datapager

Old forum URL: forums.lhotka.net/forums/t/7740.aspx


ozhug posted on Tuesday, October 06, 2009

Hi All,

I have a asp.net listview (lvAddItems) bound to a BusinessListBase (cslaAddItems)
which returns search results used for pseudo bulk editing (adding items to another BO).
The listview is using a asp:DataPager which displays 10 rows at a time.

on the updatepanel which displays the listview (lvAddItems)
a button and the UpdateObject event of the CSLA datasource are used
to add items from the listview to the BO

protected void ButtonAddItems_Click(object sender, EventArgs e)
{

var list = lvAddItems.Items.ToList();
foreach (ListViewDataItem item in list)
{
lvAddItems.UpdateItem(item.DataItemIndex, false);
}
}

protected void cslaAddItems_UpdateObject(object sender, Csla.Web.UpdateObjectArgs e)
{
if (null != e.Values["Qty"])
{
string error = string.empty;
int id = int.Parse(e.Keys["ProductId"].ToString());
int qty = int.Parse(e.Values["Qty"].ToString());
//check some values add if ok ...
if (isOK)
{ anotherBO.AddItem(id,qty);}
else
{ errormessage += error;}
}
}

this is working fine if the items to be added are on PAGE ONE of the lvAddItems.
if the items are on page 2,3 etc it does not work.

sending
lvAddITems.UpdateItem( 1 thru 10,true); is fine
to cslaAddItems_UpdateObject the Csla.Web.UpdateObjectArgs are correct and the items are added correctly.
sending
lvAddITems.UpdateItem( 11 thru more ,true); is broken
all of the cslaAddItems_UpdateObject the Csla.Web.UpdateObjectArgs are null.

hopefully I am just missing something simple any help is appreciated.

Copyright (c) Marimer LLC