有一继承DropDownList的Web自定义控件,现在要把此DropDownList当成参数传递,请问代码该如何写?
namespace Test.WebControl
{
[DefaultProperty( "Text ")]
[ToolboxData( " <{0}:StringItemDDL runat=server> </{0}:StringItemDDL> ")]
public class TestDDL : System.Web.UI.WebControls.DropDownList
{
...
[Bindable(false), Category( "Appearance "), DefaultValue( " ")]
#region Dict
public System.Type DictType
{
set
{
//下面这个DropDownList1该如何写?
DictLookUpFactory.Create(ref DropDownList1, value);
}
}
#endregion
....
}
------解决方案--------------------------------------------------------
如果不用ref 就可用this.如果一定要ref的话可以声明个变量如DropDownList ddl = this;ref ddl
------解决方案--------------------------------------------------------
这东西只有引用传递吧,实例化对象,传地址引用