In C #, I'm trying to implement a method that I can use to bind data to any control that I pass to it (unless, of course, the control is obtained from the object associated with the databoundcontrol)
subject to the method
public void CTLBindData(ref DataBoundControl ctl){ ... }
I get an error when trying to pass a derived control to a function like the following code
DropDownList lister = new DropDownList();
CTLBindData(ref lister);
Creates a conversion error
Ok, I can accept this, but the following bothers me (perhaps because I'm used to C ++ not C #)
CTLBindData(ref (DataBoundControl)lister);
in this case, I get the error "The argument ref or out must be an assignable variable"
For clarification. Drop-down list inherits a list control that inherits from DataBoundControl
, , . , .
, ?
DC