c# - Get sum of ListView column when datapager is used -


i have listview more 6000 rows. using datapager show 100 columns in page. want total of amount column in textbox. subscribed databound event , calculating total there. but, it's giving me total per page. how can total of rows.

protected void filterlistview_databound(object sender, eventargs e)     {         double curtotal = 0;         foreach (listviewitem lit in filterlistview.items)         {             if (lit.itemtype == listviewitemtype.dataitem)             {                  linkbutton lbtotam = (linkbutton)lit.findcontrol("linkbutton22");                  if (lbtotam != null)                 {                     double curamt = 0;                     if (!double.tryparse(lbtotam.text, out  curamt)) curamt = 0;                     curtotal += curamt;                 }             }         }         filtertotalamt.text = curtotal.tostring("n2");     } 

you can sub item list view , calculate count example shown below.

decimal gtotal = 0;         foreach (listviewitem lstitem in orderlist.items)         {             gtotal += decimal.parse(lstitem.subitems[3].text);//depending on column position change line         }         grandtotal.text = convert.tostring(gtotal); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -