读书人

能把Web自定义控件本身当成参数传递吗

发布时间: 2012-02-16 21:30:36 作者: rapoo

能把Web自定义控件本身当成参数传递吗?
有一继承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
[解决办法]
这东西只有引用传递吧,实例化对象,传地址引用

读书人网 >asp.net

热点推荐