资讯   |   开发   |   选机中心   |   产品大全 | IBM | 惠普 | 联想 | 戴尔 | 苹果 | 神舟
更多: | 华硕 | 明基 | 方正 | 紫光 | TCL | 夏新 | 联宝 | 宏碁 | 七喜 | 长城 | 清华同方 | 海尔 | 三星 | 东芝 | 索尼 | 富士通 | LG | 技术 | ddnoon
当前位置:笔记本 > 软件开发 >
Advertisement
文章正文

在线等待:关于Web 用户控件的问题。

类型:转载   责任编辑:asp.net   日期:2007/05/23


热门软件下载:


   

要怎么写Web   用户控件的属性采才可以,引用控件的WEB窗体中动态控制该控件的属性。  
  比如:在   a.aspx   窗体中引用该Web   用户控件(PNLBox)。  
  则   在   a.aspx.vb文件的中怎么控制该控件(PNLBox)的属性。  
  比如:  
   
  Private   Sub   Button1_Click(ByVal   sender   As   System.Object,   ByVal   e   As   System.EventArgs)  
  Handles   Button1.Click  
   
  PNLBox.我定义的属性=“”  
  PNLBox.我定义的属性=“”  
   
  End   Sub

网友回答:

发表者:saucer

1.   yourusercontrol.ascx  
   
  <%@   Control   Inherits="YourNS.YourCodeBehindClass"   CodeBehind="yourusercontrol.ascx.cs"   %>  
  ...  
   
  2.   yourusercontrol.ascx.cs  
   
  namespace   YourNS  
  {  
      public   class   YourCodeBehindClass   :   UserControl  
      {  
                public   string   我定义的属性    
                {  
                        get   {...}  
                        set   {...}  
                }  
   
              //...  
      }  
   
  }  
   
   
  3.   yourpage.aspx  
   
  <%@   Register   TagPrefix="cc"   TagName="YourCodeBehindClass"   src="yourusercontrol.ascx"   %>  
   
  <form   runat="server">  
  <cc:YourCodeBehindClass   id="PNLBox"   runat="server"   />  
  </form>  
   
  4.   yourpage.aspx.cs:  
   
  protected   YourNS.YourCodeBehindClass   PNLBox;  
   
  ...  
   
  PNLBox.我定义的属性   =   "abc";


 

 
热门推荐笔记本: 腾龙笔记本
相关文章:
笔记本相关:
IT技术文章:
webmaster:popbb@126.com   最佳浏览:1024X768 MSIE
©2007 popbb.net All Rights Reserved