w3pop.com :: ÍøÂçѧԺ :: ASP.NET :: ASP.NET - Data Binding(Êý¾Ý°ó¶¨)
We may use data binding to fill lists with selectable items from an imported data source, like a database, an XML file, or a script.
ÎÒÃÇ¿ÉÒÔ½«µ¼ÈëµÄÊý¾ÝԴʹÓÃÊý¾Ý°ó¶¨À´°ÑÐÅÏ¢ÌîÈëÑ¡Ôñ¿òÄÚ£¬Êý¾ÝÔ´¿ÉÒÔÊÇÊý¾Ý¿â£¬XMLÎļþ»òÊǽű¾¡£
The following controls are list controls which support data binding:
ÒÔÏÂÂÞÁеĿؼþ¿ÉÒÔÖ§³ÖÊý¾Ý°ó¶¨£º
The selectable items in each of the above controls are usually defined by one or more asp:ListItem controls, like this:
ÔÚÒÔÉÏÕâЩ¿Ø¼þÒªÓпÉÑ¡ÏîĿһ°ã¶¼Òª¶¨ÒåÒ»¸ö»ò¶à¸öasp:ListItem¿Ø¼þ£¬ÏñÕâÑù£º
<html> <form runat="server"> </body> |
However, with data binding we may use a separate source, like a database, an XML file, or a script to fill the list with selectable items.
È»¶ø£¬Í¨¹ýÊý¾Ý°ó¶¨ÎÒÃÇ¿ÉÒÔʹÓ÷ÖÀëµÄÔ´£¬±ÈÈçÊý¾Ý¿â£¬XMLÎļþ»òÊǽű¾£¬ÈÃÆäÖеÄÐÅÏ¢ÌîÈë¿ÉÑ¡ÔñÏîÄ¿ÖС£
By using an imported source, the data is separated from the HTML, and any changes to the items are made in the separate data source.
ͨ¹ýʹÓõ¼ÈëµÄÔ´£¬Êý¾Ý¿É´ÓHTMLÖзÖÀ뿪£¬ÈκÎÏîÄ¿ÐÅÏ¢µÄ¸Ä±äÖ»Òª¸Ä±äËüµÄÊý¾ÝÔ´¾Í¿ÉÒÔʵÏÖ¡£
In the next three chapters, we will describe how to bind data from a scripted data source.
ÔÚ½ÓÏÂÀ´µÄÈý¸öƪÕ£¬ÎÒÃǽ«²ûÊöÈçºÎ°ó¶¨À´×Խű¾µÄÊý¾ÝÔ´¡£
ÆÀÂÛ (0)
All