public class1 {
public string prop1;
public string prop2;
}
My setup was an object array of class1 which has a property prop1 and prop2:
class1[] arrClass = new class1[arraySize];
Then I set the DataTextField and DataValue:
checkboxlist1.DataSource = arrClass;
checkboxlist1.DataTextField = "prop1";
checkboxlist1.DataValueField = "prop2";
checkboxlist1.DataBind();
This throws the error above. The fix is the lack of accessors in the class, class1. The class should be corrected to the following:
public class1 {
public string prop1 { get; set; }
public string prop2 { get; set; }
}Technically, set is not needed.
No comments:
Post a Comment