Calling identically named properties
-
RadioButtonList and CheckBoxList both share certain common properties (e.g. RepeatColumns RepeatDirection RepeatLayout ) However these properties are not inherited from a common ancestor. Is there any neat way I can have 1 common function accepting either a RadioButtonList or CheckBoxList and use these properties within the function method without having to check the type and then casting to 1 or the other?
-
RadioButtonList and CheckBoxList both share certain common properties (e.g. RepeatColumns RepeatDirection RepeatLayout ) However these properties are not inherited from a common ancestor. Is there any neat way I can have 1 common function accepting either a RadioButtonList or CheckBoxList and use these properties within the function method without having to check the type and then casting to 1 or the other?
You could do it with reflection. But that's about it.
-
RadioButtonList and CheckBoxList both share certain common properties (e.g. RepeatColumns RepeatDirection RepeatLayout ) However these properties are not inherited from a common ancestor. Is there any neat way I can have 1 common function accepting either a RadioButtonList or CheckBoxList and use these properties within the function method without having to check the type and then casting to 1 or the other?
-
You could create your own class which wraps either a RadioButtonList or a CheckBoxList and exposes those common properties. It still wouldn't be an entirely statisfactory solution, but at least it would hide all the messy type checking and casting.
Thanks for the responses. I was just checking that I wasn't missing something obvious. Cheers. Martin