首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

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

2012-02-16 
能把Web自定义控件本身当成参数传递吗?有一继承DropDownList的Web自定义控件,现在要把此DropDownList当成

能把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
[解决办法]
这东西只有引用传递吧,实例化对象,传地址引用

热点排行