zoukankan      html  css  js  c++  java
  • 在aspx文件中调用ascx用户自定义控件的属性

       我们使用以下的方法来做:首先先定义自定义控件 *.ascx

    public class yourcontrol : System.Web.UI.UserControl

    {

        pravite string _Mytext

        public string Mytext

        {

             get{ ... }

             set{ ... }

        }

    }

        

    在调用它的 .aspx文件中:

    首先要注册自定义控件,注册的语句要写到页面的上方(属于页面指令的位置。   )

    <%@ Register TagPrefix="uc1" TagName="yourcontrol" Src="yourcontrol.ascx"%>

    然后在aspx文件中使用:

    <uc1:yourcontrol ID="yourControl1" runat="server"></前缀:控件标签名>

    使用自定义控件的属性在 .aspx.cs文件中:

    protected yourControl yourcontrol1;

    yourcontrol1.Mytext = "";

  • 相关阅读:
    oracle_case when
    sql记录
    修改tomcat默认编码
    sql server_TED(透明数据加密)
    web请求过程
    freemarker 标签循环list 以及获取下标值
    鼠标操作
    窗口切换
    日历控件
    xpath定位
  • 原文地址:https://www.cnblogs.com/lljinz/p/2042932.html
Copyright © 2011-2022 走看看