[I have an application where , i have a radiobuttonlist having 2 radio buttons radiobuttons RB1 & RB2
and there are 6 checkBoxes CB1 thru CB6
If RB1 is selected then CB6 shld be disable /invisible and if RB2 is selected then all the CBs shld be enabled. How do i do this?

protected void rb_OnIndexChanged(object sender, System.EventArgs e)
	{				
if (rb.SelectedValue=="A")
	{
	cb6.Enabled=true;
	}
	}

i get an error Object reference not set to an instance of an object
plz help.
thank you

Recommended Answers

All 2 Replies

try this :

private void RB1_CheckedChanged(object sender, System.EventArgs e)
{
	if (RB1.Checked == true)
	{
		C1.Enabled = true;
		C2.Enabled = true;
		C3.Enabled = true;
		C4.Enabled = true;
		C5.Enabled = true;
		C6.Enabled = false;
	}
}

private void RB2_CheckedChanged(object sender, System.EventArgs e)
{
	if (RB2.Checked == true)
	{
		C1.Enabled = false;
		C2.Enabled = false;
		C3.Enabled = false;
		C4.Enabled = false;
		C5.Enabled = false;
		C6.Enabled = false;
	}
}

thnx Jx_Man. i will surely try this tomorrow. and let u know.

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.