ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: ASP.NET :: ASP.NET - Data Binding(Êý¾Ý°ó¶¨)

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

ASP.NET
ASP.NETÖÐ Bin,Ap..
C#ÖÐnewºÍoverrid..
ASP.NET 2.0 - Na..
ASP.NET 2.0 - Ma..
ASP.NET 2.0 ÐÂÌØ..
ASP.NET - Databa..
ASP.NET - The Da..
ASP.NET - Repeat..
ASP.NET - XML ÎÄ..
ASP.NET - The So..
ASP.NET - The Ha..
ASP.NET - The Ar..
ASP.NET - Data B..
ASP.NET - °´Å¥¿Ø..
ASP.NET - TextBo..
ASP.NET ά³Öä¯ÀÀ..
ASP.NET Web ±íµ¥
ASP.NET - ʼþ
ASP.NET - ·þÎñÆ÷..
asp.netµÄÍøÒ³

ASP.NET - Data Binding(Êý¾Ý°ó¶¨)


×÷Õß:w3schools ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-08-07 ä¯ÀÀ:2803 :: ::

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Îļþ»òÊǽű¾¡£


Data Binding
Êý¾Ý°ó¶¨

The following controls are list controls which support data binding:
ÒÔÏÂÂÞÁеĿؼþ¿ÉÒÔÖ§³ÖÊý¾Ý°ó¶¨£º

  • asp:RadioButtonList
  • asp:CheckBoxList
  • asp:DropDownList
  • asp:Listbox

The selectable items in each of the above controls are usually defined by one or more asp:ListItem controls, like this:
ÔÚÒÔÉÏÕâЩ¿Ø¼þÒªÓпÉÑ¡ÏîĿһ°ã¶¼Òª¶¨ÒåÒ»¸ö»ò¶à¸öasp:ListItem¿Ø¼þ£¬ÏñÕâÑù£º

<html>
<body>
<form runat="server">
<asp:RadioButtonList id="countrylist" runat="server">
<asp:ListItem value="N" text="Norway" />
<asp:ListItem value="S" text="Sweden" />
<asp:ListItem value="F" text="France" />
<asp:ListItem value="I" text="Italy" />
</asp:RadioButtonList>
</form>
</body>
</html>

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