如何显示多个所选列表框项目的相应总销售价格 [英] how to display corresponding total sale price of multiple selected list box items

查看:61
本文介绍了如何显示多个所选列表框项目的相应总销售价格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的网络表单上我有一个多选列表框控件,用户可以在其中选择任意数量的lot_code,在下一个文本框中我想显示所有选中的总成本来自sql server数据表的lot_codes。

我怎么能实现这个请帮助。



i我这样做但是它不起作用。



Hi,
on my web form i have a multiple selection list box control in which user can select any number of lot_code, in the next text box i want to display total cost of all the selected lot_codes from sql server data table.
how can i implement this please help.

i am doing like this but it''s not working.

protected void lstLotBided_SelectedIndexChanged(object sender, EventArgs e)
   {
       txtsaleprice.Text = "People Records : " + lstLotBided.Items.Count.ToString();

       if ((lstLotBided.Items.Count > 0 && lstLotBided.SelectedIndex >= 0))
       {
           dt = objEmd.SelectSale_Price(lstLotBided.SelectedValue);
           double tempsaleprice = 0;
           for (int i = 0; i < lstLotBided.Items.Count; i++)
           {
               if (lstLotBided.Items[i].Selected)
               {
                   tempsaleprice = tempsaleprice + Convert.ToDouble(lstLotBided.Items[i].Text);

               }
           }
           txtsaleprice.Text = tempsaleprice.ToString();
       }
       else
       {
           txtsaleprice.Text = "";
       }
   }



任何建议。

谢谢


any suggestions.
thanks

推荐答案

您好


在列表选择的索引更改事件中,您可以添加总计并分配给结果文本框



谢谢

Mohan
Hi
In List selected index change event you can add the total and assign to Result textbox

Thanks
Mohan


这篇关于如何显示多个所选列表框项目的相应总销售价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆