This is a follow on from a post I raised yesterday in relation to issues with binding data to a datarepeater. I have gotten to the source of the problem but am not quite sure how to correct it.
I have a checkbox as a control in a datarepeater object. I have an event handler function which handles the checkchanged event for this checkbox and sets the visibility of other fields based on it.
However, the problem I am having is that the event handler function is getting fired when I set the datasource for the datarepeater - hence when the data is being populated. So the event handler function ends up trying to set the visibility of a field that has not been created yet and bombs out with a NullReferenceException error.
Is there a way to stop this event handler being fired when the datarepeater is being populated? I only want this function to be called if that checkbox is changed by the user after the form has loaded.
I have a checkbox as a control in a datarepeater object. I have an event handler function which handles the checkchanged event for this checkbox and sets the visibility of other fields based on it.
However, the problem I am having is that the event handler function is getting fired when I set the datasource for the datarepeater - hence when the data is being populated. So the event handler function ends up trying to set the visibility of a field that has not been created yet and bombs out with a NullReferenceException error.
Is there a way to stop this event handler being fired when the datarepeater is being populated? I only want this function to be called if that checkbox is changed by the user after the form has loaded.