当前位置: 代码迷 >> ASP.NET >> 能把Web自定义控件本身当成参数传递吗?解决方案
  详细解决方案

能把Web自定义控件本身当成参数传递吗?解决方案

热度:3336   发布时间:2013-02-25 00:00:00.0
能把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
------解决方案--------------------------------------------------------
这东西只有引用传递吧,实例化对象,传地址引用
  相关解决方案