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
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 ...
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ìm kiếm theo từ khóa liên quan:
thủ thuật lập trình chương trình lập trình lập trình căn bản ASP ASP.Net cách tạo RSS trong ASP.NETTài liệu liên quan:
-
114 trang 250 2 0
-
80 trang 227 0 0
-
Thủ thuật giúp giải phóng dung lượng ổ cứng
4 trang 217 0 0 -
NGÂN HÀNG CÂU HỎI TRẮC NGHIỆM THIẾT KẾ WEB
8 trang 216 0 0 -
Hướng dẫn lập trình với Android part 4
5 trang 156 0 0 -
Giáo trình Lập trình C căn bản - HanoiAptech Computer Education Center
136 trang 137 0 0 -
142 trang 130 0 0
-
124 trang 118 3 0
-
150 trang 105 0 0
-
78 trang 103 0 0