日期:2014-05-18  浏览次数:20398 次

各位能不能贴个asp.net2.0 的二级联动的代码上来啊,
如题。

------解决方案--------------------
<table border= "0 " cellpadding= "0 " cellspacing= "0 ">
<tr>
<td>
<asp:DropDownList ID= "CDNameDrop " runat= "server " AutoPostBack= "True ">
<asp:ListItem> 华北 </asp:ListItem>
<asp:ListItem> 东北 </asp:ListItem>
<asp:ListItem> 华东 </asp:ListItem>
<asp:ListItem> 中南 </asp:ListItem>
<asp:ListItem> 西南 </asp:ListItem>
<asp:ListItem> 西北 </asp:ListItem>
</asp:DropDownList>
</td>
<td>
<asp:UpdatePanel ID= "UpdatePanel1 " runat= "server " UpdateMode= "Conditional ">
<ContentTemplate>
<asp:DropDownList ID= "DropDownList1 " runat= "server " DataSourceID= "CitySDB " DataTextField= "CityName "
DataValueField= "CityID ">
</asp:DropDownList>
<asp:SqlDataSource ID= "CitySDB " runat= "server " ConnectionString= " <%$ ConnectionStrings:HotBeaultyConnectionString %> "
SelectCommand= "SELECT * FROM [City] WHERE ([CDName] = @CDName) ">
<SelectParameters>
<asp:ControlParameter ControlID= "CDNameDrop " Name= "CDName " PropertyName= "SelectedValue "
Type= "String " />
</SelectParameters>
</asp:SqlDataSource>
</ContentTemplate>
<Triggers> <asp:AsyncPostBackTrigger ControlID= "CDNameDrop " EventName= "SelectedIndexChanged " /> </Triggers>
</asp:UpdatePanel>
</td>
</tr>
</table>