<address id="xpjh9"><listing id="xpjh9"><meter id="xpjh9"></meter></listing></address>

<address id="xpjh9"><address id="xpjh9"><listing id="xpjh9"></listing></address></address>
<noframes id="xpjh9">
<noframes id="xpjh9">

<address id="xpjh9"><address id="xpjh9"><listing id="xpjh9"></listing></address></address>
    <form id="xpjh9"></form><address id="xpjh9"><listing id="xpjh9"><menuitem id="xpjh9"></menuitem></listing></address>

      <noframes id="xpjh9">
      VB.net 2010 視頻教程 VB.net 2010 視頻教程 VB.net 2010 視頻教程
      SQL Server 2008 視頻教程 c#入門經典教程 Visual Basic從門到精通視頻教程
      當前位置:
      首頁 > 網站開發 > ASP.net 4.0教程 >
      • asp.net教程之Web Forms - XML 文件

      • 2017-05-17 21:01 來源:未知

      我們可以綁定 XML 文件到列表控件。

      一個 XML 文件

      這里有一個名為 "countries.xml" 的 XML 文件:

      
      	
      1. <?xml version="1.0" encoding="ISO-8859-1"?> <countries> <country> <text>Norway</text> <value>N</value> </country> <country> <text>Sweden</text> <value>S</value> </country> <country> <text>France</text> <value>F</value> </country> <country> <text>Italy</text> <value>I</value> </country> </countries>
      復制

      綁定 DataSet 到 List 控件

      首先,導入 "System.Data" 命名空間。我們需要該命名空間與 DataSet 對象一起工作。把下面這條指令包含在 .aspx 頁面的頂部:

      
      	
      1. <%@ Import Namespace="System.Data" %>
      復制

      接著,為 XML 文件創建一個 DataSet,并在頁面第一次加載時把這個 XML 文件載入 DataSet:

      
      	
      1. <script runat="server"> sub Page_Load if Not Page.IsPostBack then dim mycountries=New DataSet mycountries.ReadXml(MapPath("countries.xml")) end if end sub
      復制

      為了綁定數據到 RadioButtonList 控件,首先要在 .aspx 頁面中創建一個 RadioButtonList 控件(不帶任何 asp:ListItem 元素):

      
      	
      1. <html> <body> <form runat="server"> <asp:RadioButtonList id="rb" runat="server" AutoPostBack="True" /> </form> </body> </html>
      復制

      然后添加創建 XML DataSet 的腳本,并且綁定 XML DataSet 中的值到 RadioButtonList 控件:

      
      	
      1. <%@ Import Namespace="System.Data" %> <script runat="server"> sub Page_Load if Not Page.IsPostBack then dim mycountries=New DataSet mycountries.ReadXml(MapPath("countries.xml")) rb.DataSource=mycountries rb.DataValueField="value" rb.DataTextField="text" rb.DataBind() end if end sub </script> <html> <body> <form runat="server"> <asp:RadioButtonList id="rb" runat="server" AutoPostBack="True" onSelectedIndexChanged="displayMessage" /> </form> </body> </html>
      復制

      然后我們添加一個子例程,當用戶點擊 RadioButtonList 控件中的某個項目時,該子例程會被執行。當某個單選按鈕被點擊時,label 中會出現一行文本:

      實例

      
      	
      1. <%@ Import Namespace="System.Data" %> <script runat="server"> sub Page_Load if Not Page.IsPostBack then dim mycountries=New DataSet mycountries.ReadXml(MapPath("countries.xml")) rb.DataSource=mycountries rb.DataValueField="value" rb.DataTextField="text" rb.DataBind() end if end sub sub displayMessage(s as Object,e As EventArgs) lbl1.text="Your favorite country is: " & rb.SelectedItem.Text end sub </script> <html> <body> <form runat="server"> <asp:RadioButtonList id="rb" runat="server" AutoPostBack="True" onSelectedIndexChanged="displayMessage" /> <p><asp:label id="lbl1" runat="server" /></p> </form> </body> </html>
      復制
       

      相關教程
      江苏快3 www.625477.com | www.51515j.com | www.987jc.com | www.192762.com | www.810620.com | www.3478y.cc | www.61655l.com | www.81233c.com | www.88266h.com | www.71399t.com | www.60007p.com | www.499428.com | www.803875.com | www.80767x.com | www.320660.com | www.225105.com | www.501354.com | www.701524.com | www.609477.com | www.fh52.com | www.399010.com | www.542770.com | www.307281.com | www.am7979.com | www.881799a.com | www.784782.com | www.057452.com | www.77802p.com | www.hjin5.com | www.493356.com | www.81520r.com | www.qmkl2.com | www.xinyc5.com | www.50054b.com | www.bxcp3.com | www.167090.com | www.98255.com | www.933709.com | www.136031.com | www.34788d.com | www.907556.com | www.99788r.com | www.2408b.com | www.623660.com | www.08588m.com | www.841879.com | www.49956g.com | www.ch8678.com | www.84499f.com | www.qbwc3.com | www.237344.com | www.9478q.com | www.621477.com | www.36787g.com | www.658997.com | www.33358c.com | www.583877.com | www.39391.cc | www.156050.com | www.czg4.com | www.34788h.com | www.848966.com | www.76520n.com | www.452801.com | www.m.55xj.vip | www.96386x.com | www.904859.com | www.50024g.com | www.237399.com | www.gy11.com | www.9149k.com | www.332760.com | www.w983.com | www.66621q.com | www.589544.com | www.9889hc.com | www.61655s.com | www.52303p.com | www.91233r.com | www.tlcp4.com | www.08500w.com | www.503477.com | www.927576.com | www.42969.com | www.60108x.com | www.716866.com | www.cll168.com | www.99788s.com | www.938751.com | www.36788.com | www.082709.com | www.785779.com | www.3126l.com | www.77803f.com | www.320493.com | www.768299.com | www.4444y.cc | www.43818g.com | www.34788d.com | www.258029.com | www.54968f.com | www.hr5888.com | www.99jtk.com | www.50080b.com | www.61233m.com | www.55djcp.com | www.911373.com | www.22czt.com | www.50064f.com | www.43818w.com | www.106367.com | www.431016.com | www.711893.com | www.gy11.com | www.df94.com | www.09xyc.com | www.00840b.com | www.51331c.com | www.88266m.com | www.33588k.com | www.54400x.com | www.60108o.com | www.61655z.com | www.55228e.com | www.50054r.com | www.54400x.com | www.60123p.com | www.66376c.com | www.61655v.com | www.50051x.com | www.03500w.com | www.53900l.com | www.9889hc.com | www.9356k.com | www.07163g.com | www.3890t.com | www.3890n.com | www.2tdc.com | www.lcw997.com | www.837772.com | www.771049.com | www.648377.com | www.561518.com | www.271902.com | www.bxcp3.com | www.49956g.com | www.77114t.com | www.23636vip.com | www.792088.com | www.355711.com | www.80065i.com | www.60108q.com | www.022v.cc | www.911924.com | www.584611.com | www.178795.com | www.60007c.com | www.60108z.com | www.636by.com | www.902775.com | www.271696.com | www.29277y.com | www.9889hc.com | www.796786.com | www.208990.com | www.26878i.com | www.5522k.cc | www.701549.com | www.106572.com | www.08588n.com | www.971291.com | www.202374.com | www.77801r.com | www.yy63.com | www.32123u.com | www.099wy.com | www.656121.com | www.55885i.com | www.bang | www.lcw199.com | www.9356c.com | www.860705.com | www.072211.com | www.5522s.cc | www.358773.com | www.60108c.com | www.848566.com | www.50052p.com | www.bxcp3333.com | www.60007w.com | www.66qxc.com | www.389044.com | www.68689g.com | www.897030.com | www.60108g.com | www.sytg7.com | www.060640.com | www.500cd.com | www.366098.com | www.39500d.com | www.lcw997.com | www.33588l.com | www.hcw332.com | www.36788g.com | www.98528f.com | www.39500g.com | www.283550.com | www.43818w.com | www.lcw997.com | www.29277x.com | www.785382.com | www.35155q.com | www.yc7701.com | www.6364b.com | www.299078.com | www.5xcr.com | www.52303w.com | www.362322.com | www.669by.com | www.50024t.com | www.717229.com | www.022b.cc | www.77114y.com | www.xinyc3.com | www.39459.cc | www.32123h.com | www.542511.com | www.361gc.com | www.52303c.com | www.guocai667.com | www.9889hc.com | www.71399j.com | www.599474.com | www.zuan333.com | www.65707m.com | www.180435.com | www.708270.com | www.528qx.com | www.32123d.com | www.355243.com | www.825799.com | www.062wy.com | www.65707x.com | www.178615.com | www.706515.com | www.sygj1.com | www.35155h.com | www.51515v.com | www.196509.com | www.lcw199.com | www.849770.com | www.tj52.com | www.23hf.com | www.99jtd.com | www.7777y.cc | www.6364g.com | www.35918w.com | www.12455z.com | www.50054b.com | www.91233p.com | www.320667.com | www.544141.com | www.652291.com | www.807683.com | www.938904.com | www.c6186.com | www.hf5881.com | www.ywzuqiu.com | www.5441v.com | www.9818h.cc | www.16wa.com | www.783802.com | www.799439.com | www.902257.com | www.c5909.com | www.c129.vip | www.808399.com | www.771645.com | www.745568.com | www.679955.com | www.550435.com | www.506752.com | www.326477.com | www.231844.com | www.030238.com | www.83993p.com | www.78700f.com | www.50051e.com | www.84499x.com | www.12455b.com | www.2109d.com | www.f093.com | www.558610.com | www.355245.com | www.170882.com | www.50064m.com | www.66376r.com | www.39669.cc | www.ct6676.com | www.648377.com | www.065966.com | www.00840i.com | www.cll168.com | www.c5615.com | www.hcw266.com | www.178271.com | www.41518s.com | www.50064h.com | www.600hc.com | www.643552.com | www.259291.com | www.43131z.com | www.9356r.com | www.976917.com | www.393860.com | www.25688i.com | www.ybao4.com | www.552358.com | www.60007r.com | www.3126a.com | www.709812.com | www.83033c.com | www.3005x.com | www.602952.com | www.52303o.com | www.yi636.com | www.500107.com | www.00840l.com | www.997666.com | www.091899.com | www.8816p.com | www.586005.com | www.99677y.com | www.hjin5.com | www.108129.com | www.4189a.com | www.576590.com | www.88266r.com | www.am8080.com | www.038909.com | www.3416e.com | www.372477.com | www.23636n.com | www.573678.com | www.61233m.com | www.652361.com | www.68568d.com | www.700539.com | www.50052l.com | www.583792.com | www.76762.cc | www.156518.com | www.8fk.com | www.281877.com | www.939623.com | www.16878g.com | www.xinyc8.com | www.07163y.com | www.fh7557.com | www.001hy.cc | www.52303t.com | www.876928.com | www.66376j.com | www.498166.com | www.3416i.com | www.043552.com | www.932779.com | www.36788h.com | www.307816.com | www.c1371.com | www.53900m.com | www.312299.com | www.hx1164.com | www.81678d.com | www.330265.com | www.hm2777.com | www.78700g.com | www.330895.com | www.hj8987.com | www.21202t.com | www.84499s.com | www.596608.com | www.500pt.com | www.80767p.com | www.235952.com | www.743552.com | www.055s.cc | www.84499b.com | www.177949.com | www.763829.com | www.an966.com | www.25688p.com | www.87668k.com | www.550264.com | www.98528f.com | www.085wy.com | www.16878b.com | www.26878g.com | www.96386t.com | www.hcw332.com | www.689826.com | www.54968f.com | www.bai84.com | www.022jx.cc | www.656by.com | www.42969.com | www.99638m.com | www.025738.com | www.362477.com | www.xinyc6.com | www.guocai667.com | www.982570.com | www.23040.com | www.060wy.com | www.055y.cc | www.1248g.cc | www.082wy.com | www.030.la | www.44czt.com | www.981jc.com | www.986jc.com | www.055cp.cc | www.can80.com | www.zfcp7.com | www.qbwc5.com | www.637012.com | www.54968f.com | www.901833.com | www.816464.com | www.679610.com | www.609710.com | www.hcw332.com | www.290282.com | www.033918.com | www.52303z.com | www.77114d.com | www.7793b.com | www.065wy.com | www.c757.vip | www.549577.com | www.114149.com | www.50788c.com | www.50064m.com | www.788cb.com | www.cp701.vip | www.630958.com | www.175903.com | www.35918m.com | www.6611f.cc | www.821619.com | www.352477.com | www.51515h.com | www.59988.cc | www.802733.com | www.262918.com | www.86267n.com | www.091wy.com | www.707602.com | www.082965.com | www.54400q.com | www.ck09.com | www.390675.com | www.21202g.com | www.451.cc | www.535666e.com | www.21202w.com | www.66fzc.com | www.444073.com | www.88266b.com | www.c6002.com | www.275073.com | www.50788k.com | www.809215.com | www.097968.com | www.7116a.com | www.617787.com | www.26878c.com | www.cf9907.com | www.87668t.com | www.9889hc.com | www.303470.com | www.16055.com | www.547477.com | www.60007q.com | www.802133.com | www.41518s.com | www.cf9901.com | www.77802z.com | www.ascp1.com | www.81678b.com | www.zfcp4.com | www.87668k.com | www.w635.com | www.50054i.com | www.901593.com | www.91233l.com | www.669634.com | www.33598j.com | www.423689.com | www.1368p.cc | www.80065h.com | www.216777a.com | www.33112g.com | www.701498.com | www.66368.com | www.205883.com | www.tlcp3.com | www.15355r.com | www.619939.com | www.3933h.cc | www.60108v.com | www.hcw823.com | www.6661d.cc | www.60007x.com | www.638809.com | www.1368p.cc | www.bxcp3.com | www.353990.com | www.c5829.com | www.36166k.com | www.100202.com | www.766927.com | www.999xm.cc | www.71399f.com | www.202341.com | www.817055.com | www.788cb.com | www.25688i.com | www.301823.com | www.290282.com | www.9889hc.com | www.66332r.com | www.88266m.com | www.534680.com | www.938906.com | www.1555hc.com | www.66653c.com | www.76520s.com | www.343133.com | www.727079.com | www.flff2.com | www.3416r.com | www.66652m.com | www.71233u.com | www.374677.com | www.682542.com | www.974919.com | www.dan50.com | www.2373q.com | www.12455d.com | www.80075y.com | www.50026c.com | www.83993x.com | www.177417.com | www.346411.com | www.548411.com | www.618477.com | www.762933.com | www.bxcp3.com | www.980221.com | www.hqcp4.com | www.5xch.com | www.c277.com | www.hczx6.com | www.sjgc9.com | www.396.cc | www.930xj.com | www.087wy.com | www.073wy.com | www.tang444.com | www.ok95.com | www.955381.com | www.914901.com | www.805595.com | www.655021.com | www.550247.com | www.335015.com | www.126293.com | www.77210h.com | www.29277t.com | www.60007q.com | www.27280.cc | www.ya150.com | www.768299.com | www.653546.com | www.335294.com | www.281877.com | www.95111w.com | www.9478l.com | www.44tdc.com | www.890732.com | www.577062.com | www.393830.com | www.77996d.com | www.60007k.com | www.080wy.com | www.923076.com | www.536411.com | www.73166e.com | www.50788y.com | www.11ckb.com | www.689144.com | www.535666e.com | www.91233l.com | www.913gc.com | www.730625.com | www.081307.com | www.49956z.com | www.hj8987.com | www.473552.com | www.50051j.com | www.781566.com | www.23040.com | www.082712.com | www.41518k.com | www.al5678.com | www.316477.com | www.77210k.com | www.hr9888.com | www.317299.com | www.68568q.com | www.cb3188.com | www.249880.com | www.50024n.com | www.937652.com | www.090392.com | www.cll168.com | www.636309.com | www.33588x.com | www.hm5699.com | www.175969.com | www.3668n.com | www.534211.com | www.60108p.com | www.802633.com | www.78949i.com | www.8000hc.com | www.257512.com | www.bxcp3333.com | www.550263.com | www.78700f.com | www.969949.com | www.78700h.com | www.88cmc.com | www.126509.com | www.072wy.com | www.087079.com | www.9889hc.com | www.023989.com | www.df39.com | www.52303z.com | www.98528f.com | www.16878d.com | www.689826.com | www.33598s.com | www.435050.com | www.977hf.com | www.80065l.com | www.959122.com | www.bxcp3.com | www.602891.com | www.09299.com | www.178795.com | www.hy6937.com | www.26163t.com | www.577513.com | www.984jc.com | www.71233u.com | www.775377.com | www.8499o.com | www.96386i.com | www.898364.com | www.29277h.com | www.152918.com | www.737298.com | www.8039e.com | www.80767v.com | www.674007.com | www.022zj.cc | www.29277l.com | www.hcw332.com | www.hcw266.com | www.5441r.com | www.50051t.com | www.397836.com | www.970331.com | www.cll168.com | www.50080p.com | www.364877.com | www.912484.com | www.5881.cc | www.80065d.com | www.022175.com | www.595707.com | www.14czj.com | www.29277c.com | www.50052r.com | www.178726.com | www.599649.com | www.970331.com | www.2109d.com | www.50064w.com | www.66652m.com | www.195090.com | www.572918.com | www.xinyc4.com | www.qmkl7.com | www.073wy.com | www.49956j.com | www.29277e.com | www.68568d.com | www.128760.com | www.258768.com | www.397750.com | www.578393.com | www.665039.com | www.565378.com | www.919709.com | www.c148.vip | www.ch8922.com | www.igcp8.com | www.6cpb.com | www.23040.com | www.5666hc.com | www.126kc.com | www.bang | www.99jti.com | www.ya619.com | www.65yb.com | www.hf5885.com | www.hm3988.com | www.152012.com | www.984688.com | www.897957.com | www.783802.com | www.611669.com | www.510860.com | www.318075.com | www.190882.com | www.96386y.com | www.52303e.com | www.99788j.com | www.26878x.com | www.3005y.com | www.hct5.com | www.853689.com | www.602857.com | www.332907.com | www.78949d.com | www.84499j.com | www.33588g.com | www.9889hc.com | www.870080a.com | www.xinyc8.com | www.316106.com | www.65707y.com | www.53900q.com | www.022gs.cc | www.854277.com | www.ywzuqiu.com | www.81678m.com | www.50051m.com | www.bxcp3.com | www.698771.com | www.191065.com | www.26299m.com | www.3479g.com | www.901257.com | www.327988.com | www.33112l.com | www.959zf.com | www.799436.com | www.xinyc8.com | www.55228k.com | www.gczj1.com | www.548116.com | www.54400h.com | www.371p.cc | www.618393.com | www.68568n.com | www.7782h.com | www.694880.com | www.77114y.com | www.1035o.com | www.hcw266.com | www.50064d.com | www.71gcw.com | www.368518.com | www.71233f.com | www.960121.com | www.038079.com | www.3552n.com | www.577513.com | www.08588o.com | www.c3714.com | www.083552.com | www.5091d.com | www.568001.com | www.83033j.com | www.865606.com | www.65707u.com | www.lczg6.com | www.031079.com | www.626by.com | www.202880.com | www.1035e.com | www.332910.com | www.cll168.com | www.544093.com | www.41211.cc | www.506792.com | www.8839b.com | www.345835.com | www.3126i.com | www.302591.com | www.3479x.com | www.287916.com | www.664by.com | www.063552.com | www.hr3888.com | www.36788m.com | www.737298.com | www.25688k.com | www.361770.com | www.666xm.cc | www.66652h.com | www.csw288.com | www.50051s.com | www.357876.com | www.w095.com | www.26878o.com | www.579699.com | www.105ak.com | www.77803o.com | www.744559.com | www.7782r.com | www.81233m.com | www.847677.com | www.9478j.com | www.89894h.com | www.760169.com | www.3416z.com | www.61655y.com | www.594883.com | www.66czj.com | www.80075h.com | www.231002.com | www.895853.com | www.5441z.com | www.52072v.com | www.508433.com | www.c5906.com | www.26163n.com | www.73736b.com | www.512477.com | www.980221.com | www.9928j.com | www.34788n.com | www.233591.com | www.689066.com | www.den60.com | www.07163d.com | www.68568v.com | www.357477.com | www.725422.com | www.flcb5.com | www.781566.com | www.86267l.com | www.83033v.com | www.355018.com | www.665882.com | www.336766.com | www.48wcp.com | www.7782m.com | www.66332p.com | www.50024w.com | www.90305e.com | www.320661.com | www.550247.com | www.692918.com | www.909361.com | www.c4520.com | www.23czj.com | www.277ak.com | www.8839i.com | www.35155j.com | www.80075t.com | www.07163w.com | www.50024f.com | www.78700g.com | www.178211.com | www.209703.com | www.202115.com | www.336766.com | www.196909.com | www.175906.com | www.126730.com | www.003895.com | www.88266k.com | www.71399c.com | www.52072g.com | www.29277e.com | www.84499w.com | www.54400q.com | www.08500w.com | www.3933c.com | www.091wy.com | www.czg2.com | www.967333a.com | www.900140.com | www.727076.com | www.544646.com | www.341077.com | www.99788j.com | www.52303b.com | www.77210c.com | www.9205d.com | www.25czj.com | www.152012.com | www.721560.com | www.399180.com | www.99638e.com | www.50788l.com | www.50788p.com | www.6364.com | www.958351.com | www.599309.com | www.144428.com | www.32123b.com | www.3005.am | www.cp8003.cc | www.550116.com | www.89894v.com | www.60007y.com | www.084wy.com | www.718322.com | www.178952.com | www.88065b.com | www.982jc.com | www.843879.com | www.237988.com | www.bxcp3.com | www.658zf.com | www.768399.com | www.187512.com | www.77803s.com | www.gei30.com | www.577972.com | www.66653u.com | www.8667g.com | www.717699.com | www.139620.com | www.12455q.com | www.912183.com | www.117809.com | www.00665h.com | www.815266.com | www.78949e.com | www.8667y.com | www.659789.com | www.50064k.com | www.6fa500.com | www.349477.com | www.50024h.com | www.840202.com | www.60123v.com | www.088wy.com | www.349677.com | www.50052q.com | www.744646.com | www.50026m.com | www.178012.com | www.88266z.com | www.055m.cc | www.349277.com | www.11081.cc | www.534457.com | www.33598d.com | www.599457.com | www.50026t.com | www.610958.com | www.53900k.com | www.wcp686.com | www.50732c.com | www.599830.com | www.33112h.com | www.290282.com | www.7793p.com | www.336779.com | www.0014h.com | www.djcp004.com | www.076wy.com | www.87668v.com | www.c2808.com | www.50051p.com | www.817055.com | www.61233l.com | www.526609.com | www.2632m.com | www.062566.com | www.c1332.com | www.07163n.com | www.602985.com | www.5086p.com | www.085533.com | www.988824.com | www.66653l.com | www.361770.com | www.6fk.com | www.07163y.com | www.510830.com | www.33ckb.com | www.29178e.com | www.500227.com | www.062wy.com | www.43131t.com | www.548277.com | www.ac3177.com | www.80767r.com | www.208990.com | www.914909.com | www.5484d.com | www.50054c.com | www.404499.com | www.988456.vip | www.25688h.com | www.99638j.com | www.592113.com | www.ya958.com | www.33598c.com | www.178192.com | www.915655.com | www.2109o.com | www.89894q.com | www.506791.com | www.921599.com | www.76520z.com | www.076591.com | www.540707.com | www.qbwc1.com | www.9205a.com | www.39957a.com | www.355284.com | www.216777a.com | www.350zf.com | www.96386p.com | www.83033p.com | www.388510.com | www.ascp2.com | www.3890b.com | www.50080m.com | www.35155l.com | www.281877.com | www.183587.com | www.407872.com | www.627297.com | www.860836.com | www.949410.com | www.hf6680.com | www.tang777.com | www.202115.com | www.6611b.cc | www.87668.cc | www.33588x.com | www.60007j.com | www.77210f.com | www.bxcp3.com | www.99677n.com | www.26878d.com | www.15355u.com | www.15355d.com | www.87668m.com | www.84499c.com | www.78949s.com | www.86267hh.com | www.96386s.com | www.77802q.com | www.26299c.com | www.41855.cc | www.9889hc.com |