- 浏览: 1818598 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
yeying12:
强大
HTTP协议详解,你所不知道的 -
夏雪纷纷:
据我所知,9月12日有个对于DXperience 2013新功 ...
DXperience 9.1.3 -
Emy:
现在面临第一个坎。。
IT高薪者所具备的人格魅力 -
yangxiutian:
很详细,楼主很会总结。
IE下 z-index 的各种坑 -
idleone:
真心求指教,全选怎么实现
Android开发之ListView,加入CheckBox(复选框),实现选择列表
DropDownList
<div style="">
<div>
<img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><span style="color: rgb(0, 0, 0);">在ASP.NET2.0中,可以在数据绑定时,通过设置DropDownList的AppendDataBoundItems属性为true,在数据绑定之前添加一个新的项目,并且这个新加的项目会保存在ViewState之中。下面就是一个实现的例子:<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><strong>C#代码<br></strong><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" alt="" id="_131_151_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" alt="" style="display: none;" id="_131_151_Closed_Image"></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);"><%</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_131_151_Closed_Text">...</span><span id="_131_151_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">@PageLanguage</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">C#</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);">%></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" alt="" id="_157_189_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" alt="" style="display: none;" id="_157_189_Closed_Image"></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);"><%</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_157_189_Closed_Text">...</span><span id="_157_189_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">@ImportNamespace</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">System.Data</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);">%></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><!</span><span style="color: rgb(255, 0, 255);">DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN"<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" alt="" id="_340_1574_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" alt="" style="display: none;" id="_340_1574_Closed_Image"></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_340_1574_Closed_Text">...</span><span id="_340_1574_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">ICollectionCreateDataSource()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" id="_376_746_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" alt="" style="display: none;" id="_376_746_Closed_Image"></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_376_746_Closed_Text">...</span><span id="_376_746_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DataTabledt</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">new</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DataTable();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DataRowdr;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Columns.Add(</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">new</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DataColumn(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">id</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">typeof</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">(Int32)));<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Columns.Add(</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">new</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DataColumn(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">text</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">typeof</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">(string)));<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">for</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">(</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">int</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">i</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">0</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;i</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">6</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;i</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">++</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" id="_583_691_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" alt="" style="display: none;" id="_583_691_Closed_Image"></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_583_691_Closed_Text">...</span><span id="_583_691_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">dt.NewRow();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr[</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">0</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">]</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">i;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr[</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">1</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">]</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">列表项目</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">i.ToString();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Rows.Add(dr);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DataViewdv</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">new</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DataView(dt);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">return</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">dv;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">protected</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">void</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">Button1_Click(objectsender,EventArgse)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" id="_809_1068_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" alt="" style="display: none;" id="_809_1068_Closed_Image"></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_809_1068_Closed_Text">...</span><span id="_809_1068_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">Response.Write(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><li>DropDownList1您选择的项目:</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.SelectedValue<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.SelectedItem.Text);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">Response.Write(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><li>DropDownList2您选择的项目:</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList2.SelectedValue<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList2.SelectedItem.Text);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">protected</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">void</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">Page_Load(objectsender,EventArgse)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" id="_1128_1573_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" alt="" style="display: none;" id="_1128_1573_Closed_Image"></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_1128_1573_Closed_Text">...</span><span id="_1128_1573_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">if</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">!</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">IsPostBack)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" id="_1155_1569_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" alt="" style="display: none;" id="_1155_1569_Closed_Image"></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_1155_1569_Closed_Text">...</span><span id="_1155_1569_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.AppendDataBoundItems</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">true</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.Items.Add(</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">new</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">ListItem(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">--请选择一个选择项--</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">""</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">));<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataSource</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.DataSource</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">CreateDataSource();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataTextField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.DataTextField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">text</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataValueField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.DataValueField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">id</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.DataBind();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataBind();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(255, 0, 0);">xmlns</span><span style="color: rgb(0, 0, 255);">="http://www.w3.org/1999/xhtml"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">DropDownList补充例子</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">form</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="form1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(255, 0, 0);">ID</span><span style="color: rgb(0, 0, 255);">="DropDownList1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(255, 0, 0);">ID</span><span style="color: rgb(0, 0, 255);">="DropDownList2"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(255, 0, 0);">AppendDataBoundItems</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:ListItem</span><span style="color: rgb(255, 0, 0);">Text</span><span style="color: rgb(0, 0, 255);">="请选择"</span><span style="color: rgb(255, 0, 0);">Value</span><span style="color: rgb(0, 0, 255);">=""</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">asp:ListItem</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:Button</span><span style="color: rgb(255, 0, 0);">ID</span><span style="color: rgb(0, 0, 255);">="Button1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(255, 0, 0);">Text</span><span style="color: rgb(0, 0, 255);">="得到选择的值"</span><span style="color: rgb(255, 0, 0);">OnClick</span><span style="color: rgb(0, 0, 255);">="Button1_Click"</span><span style="color: rgb(255, 0, 0);"></span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">form</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="">VB.NET代码<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" alt="" id="_2089_2132_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" alt="" style="display: none;" id="_2089_2132_Closed_Image"></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);"><%</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_2089_2132_Closed_Text">...</span><span id="_2089_2132_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">@PageLanguage</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">VB</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">AutoEventWireup</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">true</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);">%></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" alt="" id="_2139_2171_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" alt="" style="display: none;" id="_2139_2171_Closed_Image"></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);"><%</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_2139_2171_Closed_Text">...</span><span id="_2139_2171_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">@ImportNamespace</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">System.Data</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);">%></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><!</span><span style="color: rgb(255, 0, 255);">DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN"<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" alt="" id="_2322_3696_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" alt="" style="display: none;" id="_2322_3696_Closed_Image"></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_2322_3696_Closed_Text">...</span><span id="_2322_3696_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">ProtectedSubButton1_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">Response.Write(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><li>DropDownList1您选择的项目:</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.SelectedValue</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">_<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.SelectedItem.Text)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">Response.Write(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><li>DropDownList2您选择的项目:</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList2.SelectedValue</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">_<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList2.SelectedItem.Text)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">EndSub<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">ProtectedSubPage_Load(ByValsenderAsObject,ByValeAsSystem.EventArgs)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">IfNotIsPostBackThen<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.AppendDataBoundItems</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">True<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.Items.Add(NewListItem(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">--请选择一个选择项--</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">""</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">))<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataSource</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">CreateDataSource()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.DataSource</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">CreateDataSource()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataTextField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">text</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.DataTextField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">text</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataValueField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">id</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.DataValueField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">id</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.DataBind()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataBind()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">EndIf<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">EndSub<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">FunctionCreateDataSource()AsICollection<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DimdtAsDataTable</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">NewDataTable()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DimdrAsDataRow<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Columns.Add(NewDataColumn(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">id</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,GetType(System.Int32)))<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Columns.Add(NewDataColumn(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">text</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,GetType(String)))<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">ForiAsInteger</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">0</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">To</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">6</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">dt.NewRow()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">0</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">)</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">i<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">1</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">)</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">列表项目</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">i.ToString()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Rows.Add(dr)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">Next<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DimdvAsDataView</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">NewDataView(dt)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">Returndv<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">EndFunction<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(255, 0, 0);">xmlns</span><span style="color: rgb(0, 0, 255);">="http://www.w3.org/1999/xhtml"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="Head1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">DropDownList补充例子</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">form</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="form1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(255, 0, 0);">ID</span><span style="color: rgb(0, 0, 255);">="DropDownList1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(255, 0, 0);">ID</span><span style="color: rgb(0, 0, 255);">="DropDownList2"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(255, 0, 0);">AppendDataBoundItems</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:ListItem</span><span style="color: rgb(255, 0, 0);">Text</span><span style="color: rgb(0, 0, 255);">="请选择"</span><span style="color: rgb(255, 0, 0);">Value</span><span style="color: rgb(0, 0, 255);">=""</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">asp:ListItem</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:Button</span><span style="color: rgb(255, 0, 0);">ID</span><span style="color: rgb(0, 0, 255);">="Button1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(255, 0, 0);">Text</span><span style="color: rgb(0, 0, 255);">="得到选择的值"</span><span style="color: rgb(255, 0, 0);">OnClick</span><span style="color: rgb(0, 0, 255);">="Button1_Click"</span><span style="color: rgb(255, 0, 0);"></span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">form</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span>
</div>
</div>
<p> 另外,还可以使用下面的方法添加:</p>
<div style="">
<div>
<span style="color: rgb(0, 0, 255);">protected</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">DropDownList1_DataBound(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">sender,EventArgse)<br>{<br>DropDownList1.Items.Insert(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">ListItem(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">--请选择--</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">""</span><span style="color: rgb(0, 0, 0);">));<br>}</span>
</div>
</div>
<div>
<img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><span style="color: rgb(0, 0, 0);">在ASP.NET2.0中,可以在数据绑定时,通过设置DropDownList的AppendDataBoundItems属性为true,在数据绑定之前添加一个新的项目,并且这个新加的项目会保存在ViewState之中。下面就是一个实现的例子:<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><strong>C#代码<br></strong><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" alt="" id="_131_151_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" alt="" style="display: none;" id="_131_151_Closed_Image"></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);"><%</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_131_151_Closed_Text">...</span><span id="_131_151_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">@PageLanguage</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">C#</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);">%></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" alt="" id="_157_189_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" alt="" style="display: none;" id="_157_189_Closed_Image"></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);"><%</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_157_189_Closed_Text">...</span><span id="_157_189_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">@ImportNamespace</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">System.Data</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);">%></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><!</span><span style="color: rgb(255, 0, 255);">DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN"<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" alt="" id="_340_1574_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" alt="" style="display: none;" id="_340_1574_Closed_Image"></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_340_1574_Closed_Text">...</span><span id="_340_1574_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">ICollectionCreateDataSource()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" id="_376_746_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" alt="" style="display: none;" id="_376_746_Closed_Image"></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_376_746_Closed_Text">...</span><span id="_376_746_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DataTabledt</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">new</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DataTable();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DataRowdr;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Columns.Add(</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">new</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DataColumn(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">id</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">typeof</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">(Int32)));<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Columns.Add(</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">new</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DataColumn(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">text</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">typeof</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">(string)));<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">for</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">(</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">int</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">i</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">0</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;i</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">6</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;i</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">++</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" id="_583_691_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" alt="" style="display: none;" id="_583_691_Closed_Image"></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_583_691_Closed_Text">...</span><span id="_583_691_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">dt.NewRow();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr[</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">0</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">]</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">i;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr[</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">1</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">]</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">列表项目</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">i.ToString();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Rows.Add(dr);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DataViewdv</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">new</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DataView(dt);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">return</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">dv;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">protected</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">void</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">Button1_Click(objectsender,EventArgse)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" id="_809_1068_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" alt="" style="display: none;" id="_809_1068_Closed_Image"></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_809_1068_Closed_Text">...</span><span id="_809_1068_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">Response.Write(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><li>DropDownList1您选择的项目:</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.SelectedValue<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.SelectedItem.Text);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">Response.Write(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><li>DropDownList2您选择的项目:</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList2.SelectedValue<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList2.SelectedItem.Text);<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">protected</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">void</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">Page_Load(objectsender,EventArgse)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" id="_1128_1573_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" alt="" style="display: none;" id="_1128_1573_Closed_Image"></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_1128_1573_Closed_Text">...</span><span id="_1128_1573_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">if</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">!</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">IsPostBack)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" id="_1155_1569_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" alt="" style="display: none;" id="_1155_1569_Closed_Image"></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_1155_1569_Closed_Text">...</span><span id="_1155_1569_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">{<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.AppendDataBoundItems</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">true</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.Items.Add(</span><span style="color: rgb(0, 0, 255); background-color: rgb(245, 245, 245);">new</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">ListItem(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">--请选择一个选择项--</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">""</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">));<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataSource</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.DataSource</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">CreateDataSource();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataTextField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.DataTextField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">text</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataValueField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.DataValueField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">id</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.DataBind();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataBind();<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" alt="">}</span></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(255, 0, 0);">xmlns</span><span style="color: rgb(0, 0, 255);">="http://www.w3.org/1999/xhtml"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">DropDownList补充例子</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">form</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="form1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(255, 0, 0);">ID</span><span style="color: rgb(0, 0, 255);">="DropDownList1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(255, 0, 0);">ID</span><span style="color: rgb(0, 0, 255);">="DropDownList2"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(255, 0, 0);">AppendDataBoundItems</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:ListItem</span><span style="color: rgb(255, 0, 0);">Text</span><span style="color: rgb(0, 0, 255);">="请选择"</span><span style="color: rgb(255, 0, 0);">Value</span><span style="color: rgb(0, 0, 255);">=""</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">asp:ListItem</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:Button</span><span style="color: rgb(255, 0, 0);">ID</span><span style="color: rgb(0, 0, 255);">="Button1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(255, 0, 0);">Text</span><span style="color: rgb(0, 0, 255);">="得到选择的值"</span><span style="color: rgb(255, 0, 0);">OnClick</span><span style="color: rgb(0, 0, 255);">="Button1_Click"</span><span style="color: rgb(255, 0, 0);"></span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">form</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="">VB.NET代码<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" alt="" id="_2089_2132_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" alt="" style="display: none;" id="_2089_2132_Closed_Image"></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);"><%</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_2089_2132_Closed_Text">...</span><span id="_2089_2132_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">@PageLanguage</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">VB</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">AutoEventWireup</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">true</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);">%></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" alt="" id="_2139_2171_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" alt="" style="display: none;" id="_2139_2171_Closed_Image"></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);"><%</span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_2139_2171_Closed_Text">...</span><span id="_2139_2171_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">@ImportNamespace</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">System.Data</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span></span><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 0);">%></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><!</span><span style="color: rgb(255, 0, 255);">DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN"<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt="">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" alt="" id="_2322_3696_Open_Image"><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" alt="" style="display: none;" id="_2322_3696_Closed_Image"></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="_2322_3696_Closed_Text">...</span><span id="_2322_3696_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">ProtectedSubButton1_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">Response.Write(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><li>DropDownList1您选择的项目:</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.SelectedValue</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">_<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList1.SelectedItem.Text)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">Response.Write(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><li>DropDownList2您选择的项目:</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList2.SelectedValue</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">_<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">DropDownList2.SelectedItem.Text)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">EndSub<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">ProtectedSubPage_Load(ByValsenderAsObject,ByValeAsSystem.EventArgs)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">IfNotIsPostBackThen<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.AppendDataBoundItems</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">True<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.Items.Add(NewListItem(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">--请选择一个选择项--</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">""</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">))<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataSource</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">CreateDataSource()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.DataSource</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">CreateDataSource()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataTextField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">text</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.DataTextField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">text</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataValueField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">id</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.DataValueField</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">id</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList1.DataBind()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DropDownList2.DataBind()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">EndIf<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">EndSub<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">FunctionCreateDataSource()AsICollection<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DimdtAsDataTable</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">NewDataTable()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DimdrAsDataRow<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Columns.Add(NewDataColumn(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">id</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,GetType(System.Int32)))<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Columns.Add(NewDataColumn(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">text</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">,GetType(String)))<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">ForiAsInteger</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">0</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">To</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">6</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">dt.NewRow()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">0</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">)</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">i<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dr(</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">1</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">)</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">列表项目</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"></span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">+</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">i.ToString()<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">dt.Rows.Add(dr)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">Next<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">DimdvAsDataView</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">NewDataView(dt)<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">Returndv<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" alt="">EndFunction<br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(255, 0, 0);">xmlns</span><span style="color: rgb(0, 0, 255);">="http://www.w3.org/1999/xhtml"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="Head1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">DropDownList补充例子</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">form</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="form1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(255, 0, 0);">ID</span><span style="color: rgb(0, 0, 255);">="DropDownList1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(255, 0, 0);">ID</span><span style="color: rgb(0, 0, 255);">="DropDownList2"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(255, 0, 0);">AppendDataBoundItems</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:ListItem</span><span style="color: rgb(255, 0, 0);">Text</span><span style="color: rgb(0, 0, 255);">="请选择"</span><span style="color: rgb(255, 0, 0);">Value</span><span style="color: rgb(0, 0, 255);">=""</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">asp:ListItem</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">asp:DropDownList</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">asp:Button</span><span style="color: rgb(255, 0, 0);">ID</span><span style="color: rgb(0, 0, 255);">="Button1"</span><span style="color: rgb(255, 0, 0);">runat</span><span style="color: rgb(0, 0, 255);">="server"</span><span style="color: rgb(255, 0, 0);">Text</span><span style="color: rgb(0, 0, 255);">="得到选择的值"</span><span style="color: rgb(255, 0, 0);">OnClick</span><span style="color: rgb(0, 0, 255);">="Button1_Click"</span><span style="color: rgb(255, 0, 0);"></span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">form</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""><br><img align="top" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" alt=""></span>
</div>
</div>
<p> 另外,还可以使用下面的方法添加:</p>
<div style="">
<div>
<span style="color: rgb(0, 0, 255);">protected</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">DropDownList1_DataBound(</span><span style="color: rgb(0, 0, 255);">object</span><span style="color: rgb(0, 0, 0);">sender,EventArgse)<br>{<br>DropDownList1.Items.Insert(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">ListItem(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">--请选择--</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">""</span><span style="color: rgb(0, 0, 0);">));<br>}</span>
</div>
</div>
相关推荐
调用方法:DropDownList.bind(selectId).例如: --------------------------------- DropDownList2: <option selected="selected" value="35">gdfgfdgjjjjjjjjjjjj └All Categories ...
C#编程 WinForm窗体开发 DropDownList(源码)C#编程 WinForm窗体开发 DropDownList(源码)C#编程 WinForm窗体开发 DropDownList(源码)C#编程 WinForm窗体开发 DropDownList(源码)C#编程 WinForm窗体开发 DropDownList...
这个是ajax 实现DropDownList无刷新联动。里面有数据库结构和内容,表结构的是sql2000的, 关键代码: <SCRIPT language="javascript"> //城市------------------------------ function cityResult() ...
DropDownList无刷新三级联动 caomianpublic void getDdlInfo(DropDownList province,DropDownList city,DropDownList town,Page myPage) { //初始化省 string sql="select 序号,省名 from 省表"; SqlCommand ...
在ASP.NET 2.0 网站页面的开发过程中,经常需要把DropDownList等列表类控件的SelectedValue值设置为一个从数据库或其他地方读取出来的值。 最简单的办法就是直接进行指定: DropDownList1.SelectedValue = "中国"; ...
如果在服务器端对一个服务器端控件(如DropDownList)进行绑定后,起状态将被保存;在客户端对DropDownList(Select)赋值时,不会保存状态。当你执行提交时,会将页面发送至服务器端,通过Page_Load事件处理,在...
asp.net Dropdownlist结合CheckBoxList多选下拉框
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (this.DropDownList1.SelectedIndex == 0) { this.DropDownList2.Items.Clear(); this.DropDownList2.Items.Add("南阳...
dropdownlist下拉框实现多选
DataList中如何响应DropDownList的SelectedIndexChanged事件
ddl = (DropDownList)GridView1.Rows[i].FindControl("depList"); ddl.SelectedValue = ds.Tables[0].Rows[i]["DepId"].ToString(); ddl = (DropDownList)GridView1.Rows[i].FindControl("roleList"); ddl....
ASP.NET中dropdownlist和GridView控件的用法,简单易学,一看就懂.
dropdiwnlist的方法重写,实现listbox下拉框制定的值实现只读、不可选择的技巧(重写DROPDOWNLIST)
开发中会遇到的例子,使用dropdownlist绑定后台数据库,本例使用的是oracle可修改为其他数据库,适合新手学习。
在网上找了很多重写DropDownList控件可输入,可选择DropDownList的代码,一直没有合适的,这个代码源件是从国外网站上找来的,本人测试过可用。现在发布在网上供大家学习使用。希望能帮助大家。代码已经进行过编译,...
.net MVC下,AJAX实现DropDownList数据绑定,并实现无刷新城市联动。 内含SQL Server 数据库执行语句,只要运行一下就OK了。 运行代码时注意别忘了更改成所使用数据库的ServerName,LoginName,Password。
解决dropdownlist数据绑定后选择下拉列表后返回的值不变或为空的问题!!我就是这样解决的。本来运行好好的,后来突然不行了。。。抓耳挠腮,终于发现原来是这个原因。
C# winform Combox 下拉菜单 DropDownList 下拉选项空白无法显示文本的解决方案
ASP .NET MVC4 @Html.DropDownList后台绑定数据展示到页面下拉框中