本文介绍了计算文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在按钮单击事件中,我想计算成人和儿童的总费用,个人费用在数据列表中.帮我解决这个问题.

In button Click event i want to calculate the total cost for the adults and children, the individual cost am having in datalist. help me to solve this.

protected void datalist_p(object source, DataListCommandEventArgs e)
    {
      Label   link1 = (Label)e.Item.FindControl("lbl_adult");
        double  a = Convert.ToDouble( link1.Text);
        calculation(a);
        Label link2 = (Label)e.Item.FindControl("lbl_child");
        double b = Convert.ToDouble(link2.Text);

        calculation2(b);
    }
    public double calculation(double link)
    {
        double link1 = link;
        return link1;
    }
    public double calculation2(double linka)
    {
        double link2 = linka;
        return link2;
    }

推荐答案


这篇关于计算文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 23:13