This is a migrated thread and some comments may be shown as answers.

Accessing multiple controls inside listview

1 Answer 26 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 01 Aug 2012, 03:11 PM
I have set of controls inside of a list view in which I want to be disabled until a certain checkbox is checked.
My current code looks like this:
protected void chckRSMCA_CheckedChanged(object sender, EventArgs e)
{
            CheckBox checkboxRS = (CheckBox)sender;
            RadTextBox Id = (RadTextBox)rlvListView.FindControl("txtRSFarmIdMCA");
            RadTextBox Address = (RadTextBox)rlvListView.FindControl("txtRSSvrAddressMCA");
 
            if (checkboxRS.Checked)
            {
                Id.Enabled = true;
                Address.Enabled = true;
            }
            else
            {
                Id.Enabled = false;
                Address.Enabled = false;
            }
}

However, with this code I get null reference exception when it tries to set the Enabled setting.

1 Answer, 1 is accepted

Sort by
0
Josh
Top achievements
Rank 1
answered on 01 Aug 2012, 04:13 PM
Figured it out.
This code works however, there was a simple typo.
Tags
ListView
Asked by
Josh
Top achievements
Rank 1
Answers by
Josh
Top achievements
Rank 1
Share this question
or