UserControl!

xiaoxiao2021-03-06  48

UCL.ASCX code:

Namespace userControl {using system.data; using system.drawing; using system.web; using system.web.ui.webcontrols; using system.web.ui.htmlControls;

///

/// UCL summary description. /// public class ucl: System.Web.UI.UserControl {public String _Msg; protected System.Web.UI.WebControls.Label Label1; public int _loopu; public String _Color; public String Msg {get {return _Msg;} set {_Msg = value;}} public int loopu {get {return _loopu;} set {_loopu = value;}} public String Color {get {return _Color;} set {_Color = value;}} private void Page_Load (Object sender, system.eventargs e) {// Place the user code here to initialize the page INT i; for (i = 1; i <= _ loopu; i ) {label1.text = " _ Msg "
";

}

#Region Web Form Designer Generated Code Override Protected Void OnNit (Eventargs E) {// // Codegen: This call is required for the ASP.NET Web Form Designer. // initializeComponent (); base.oninit (e);} ///

/// Designer Support required method - Do not use code editor // to modify the contents of this method. /// private () {this.load = new system.eventhandler (this.page_load);

} #Endregion}}}

TEST.ASPX page

<% @ Page language = "c #" codebehind = "test.aspx.cs" autoeventwireup = "false" inherits = "UserControl.test"%> <% @ register tagprefix = "ucltest" tagname = "UCL" src = "UCL .ascx "%>

<% @ Register tagprefix = "ucltest" TAGNAME = "UCL" src = "ucl.ascx"%>

<% @ Register tagprefix = "ucltest" tagname = "ucl" src = "ucl.ascx"%> <% @ register tagprefix = "ucltest" tagname = "UCL" src = "ucl.ascx"%>

<% @ Register tagprefix = "ucltest" TAGNAME = "UCL" src = "ucl.ascx"%>

<% @ Register tagprefix = "ucltest" TAGNAME = "UCL" src = "ucl.ascx"%>

转载请注明原文地址:https://www.9cbs.com/read-119816.html

New Post(0)