I have created checkbox as follow

System.Web.UI.WebControls.CheckBox ch = new System.Web.UI.WebControls.CheckBox();                    
                    ch.Checked = true;
                    tc.Controls.Add(ch);                    
                    ch.CheckedChanged += new EventHandler(ch_CheckedChanged);//this is my eventhandler

I created a event handler as

protected void ch_CheckedChanged(object o, EventArgs e)
    {
        string s = Response.Cookies["red"]["re"];
        
        if (v == "true")//i want the state of respective checkbox here to process my if statement
        {
            if (!pro.Contains(s))
            {
                pro.Add(s);
                dem.Remove(s);
            }
            else
            {
                dem.Remove(s);
            }
        }
        else
        {
            dem.Add(s);
            pro.Remove(s);
        }
    }

i want the state of respective checkbox in variable "v" to process my if statement

try to use this b4 if loop
v=((CheckBox) o).checked;
then if should be like this
if(v)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.