Danh mục

Chương8 Tùybiếnđiềukhiểntrong ASP.NET

Số trang: 21      Loại file: ppt      Dung lượng: 582.50 KB      Lượt xem: 12      Lượt tải: 0    
Thư Viện Số

Hỗ trợ phí lưu trữ khi tải xuống: 14,000 VND Tải xuống file đầy đủ (21 trang) 0
Xem trước 3 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Tham khảo bài thuyết trình chương8 tùybiếnđiềukhiểntrong asp.net, công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Chương8 Tùybiếnđiềukhiểntrong ASP.NETChương8Tùybiếnđiềukhiểntrong ASP.NETMụcđích Xácđịnhcầnthiếtcủaviệctạocustom controls Tạođiềukhiểnđơngiảngdùng ASP.NET TạoCompositecontroldùngC# Sửdụngsựkiệnvớicustomcontrols ExploringASP.NET/Session15/2of22 Controls Cáclớpđượcxâydựngchoviệctáisửdụngmã cầnthiếttáisửdụnglạicácđiềukhiểngiao diệnngườidùng Controlgiúptáisửdụngmộtcáchtrựcquan cũngnhưbổsungcácchứcnăngtươngứng Giúpđónggóicáckhảnăngvàphânphối ASP.NETcontrolsdùngchoWebđểtạoHTML hoặcWML,hiểnthịtrêntrìnhduyệtngườidùng ExploringASP.NET/Session15/3of22 Controls… A ssfffghfioi Assfffghfioi Jhjkhjkhjkhj Jhjkhjkhj khj Uyuuiyu iyui Uyuu iyuiyu i ghghghjggg ghghghjggg Codeforadataview Codeforadatagrid A ssfffghfioi Jhjkhjkhjkhj Uyuu iyuiyui ghghghjggg CodeforaLabelAssfffghfioi A ssfffghfioiJhjkhjkhjkhj Jhj khjkhjkhjUyuu iyuiyui Uyu uiyu iyu i ghghghjgggCodeforaradiobutton ghghghj ggg Codeforatextbox A ssfffghfioi Jhjkhjkhjkhj Uyuu iyuiyui ghghghjggg CodeforacheckboxAssfffghfioiJhjkhjkhjkhjUyuu iyuiyui ghghghjggg Codeforabutton ExploringASP.NET/Session15/4of22CustomControls Tạo theo 2 cách C# ASP.NET like Page Pagelets ExploringASP.NET/Session15/5of22 CustomControlsửdụng LabelControl MyLabel.ascxpublic string MyText{ get { // Do Nothing return(lblOne.Text); } set { lblOne.Text = value; } ExploringASP.NET/Session15/6of22 CustomControldùngLabel Control } Label.aspx ExploringASP.NET/Session15/7of22 CustomControlsdùngC#ĐiềukhiểnnàyđượcviếthoàntoàndùngC#màkhôngcầndùngbấtcứđiềukhiểnASP.NetnàoRepeater.csusing System;using System.Web;using System.Web.UI;namespace MyOwnControls{ public class TextRepeater : Control { protected override void Render(HtmlTextWriter writer) { int intCount; ExploringASP.NET/Session15/8of22 CustomControlsdùngC# for (intCount=1; intCount CustomControlsdùngC#SửdụngtrongrangASP.NetCustom control using C# ExploringASP.NET/Session15/10of22 ThuộctínhcủaCustomControls Đếchophépsửdụngtốthơncáccontrol,chúngtacóthểtạothuộc  tínhchocácđiềukhiển Cácthuộctínhnàycóthểthayđổimộtcáchtựđộng  NewRepeater.csusing System;using System.Web;using System.Web.UI;namespace MyOwnControls{ public class TextRepeater : Control { public int timesToRepeat; ExploringASP.NET/Session15/11of22 PropertiesofCustomControlspublic string myText;public int TimesToRepeat{ get { return timesToRepeat; } set { if (timesToRepeat > 10) throw new ArgumentException (The text shouldnot be repeated more than 10 times); else timesToRepeat = value; } } ExploringASP.NET/Session15/12of22 PropertiesofCustomControlspublic string MyText { get { return myText; } set { if (myText.Length > 25) throw new ArgumentException(The textshould not be more than 25 characters); else myText = value; } } ExploringASP.NET/Session15/13of22 PropertiesofCustomControls protected override void Render(HtmlTextWriter writer) { for (int Count = 1; Count CompositeControls Cáccontr ...

Tài liệu được xem nhiều: