<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>