Add a web user control problem.

zhaozj2021-02-16  88

Due to the customization of the process, the information of each process may need to be rendered repeatedly.

When I use WebUserControl, I will always appear directly to add controls in the middle of the CS.

code show as below:

WebUserControl:

Wuc.ascx

Private int _i = 0; public int i {get {return this._i;} set {this._i = value;}}

Private void Page_load (Object Sender, System.EventArgs E) {IF (! page.ispostback) {textbox box = new textbox (); box.text = this._i.to.Tostring (); this.controls.add (box); }

ASPX:

Private void page_load (object sender, system.eventargs e) {wuc uc = new wuc (); uc.i = 100; panel1.controls.add (uc);

}

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

New Post(0)