Please Help to locate the error

Posted by jagdeep on Stack Overflow See other posts from Stack Overflow or by jagdeep
Published on 2010-12-25T10:39:24Z Indexed on 2010/12/25 10:54 UTC
Read the original article Hit count: 191

Filed under:
|
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class expt2 : System.Web.UI.Page
{
    double result ;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
            result = 0.0;
 protected void Chkbxbd_CheckedChanged(object sender, EventArgs e)
    {
        if (Chkbxbd.Checked)
        {
            txtbxttl.Text = "" + 10000;
            result += double.Parse(txtbxttl.Text);

        }
        else
            result = result - 10000;


      }
    protected void Chkbxsfa_CheckedChanged(object sender, EventArgs e)
    {
        if (Chkbxsfa.Checked)
        {
            txtbxttl.Text = "" + 15000;
            result += double.Parse(txtbxttl.Text);

        }
        else
            result = result - 15000;


    }
 protected void btnttl_Click(object sender, EventArgs e)
    {
        txtbxttl.Text = "" + result;

    }
}

In this code the individual value for checkbox is ok but when the total is made it becomes 0.

Please help me to fix it.

© Stack Overflow or respective owner

Related posts about c#

Related posts about variables