带中继器的数学 [英] math with repeaters

查看:95
本文介绍了带中继器的数学的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用中继器控件创建了动态文本框
现在我需要一些数学帮助.
它将添加第一个金额框,然后添加第二个,但之后将停止

我需要在中继器中添加任何新框创建,感谢所有帮助.
:〜


I created a dynamic Text Boxes using repeater controls
now I need help in doing some math.
It add the first amount box and the second but after it stops

I need for it add any new box create in the repeater all help is appreciated.
:~


private void addallmbe()
             {
                 int totalamount = 0;
                 int subamount = 0;
                 int answers;
                 if (Amount.Text != "")
                 {
                      if(MBE.Text == "Yes")

                      {
                     foreach (RepeaterItem item in Repeater1.Items)
                     {


                     string amount = ((TextBox)item.FindControl("txtAmount")).Text;
                     totalamount = int.Parse(Amount.Text);
                     subamount = totalamount + int.Parse(amount.ToString());
                     subamount = subamount + int.Parse(amount.ToString());

                     }


                     answers = totalamount + subamount;
                     MBEAmount.Text = answers.ToString();
                     //answers.ToString(MBEAmount.Text.ToString());
                    }
                 }
             }


:〜

推荐答案

知道了,它解决了,我删除了这段代码
Got it, it fixed I remove this code
subamount = totalamount + int.Parse(amount.ToString());


感谢您的回复.

:)


Thanks for responding.

:)


subamount = totalamount + int.Parse(amount.ToString());
subamount = totalamount + int.Parse(amount.ToString());


这篇关于带中继器的数学的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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