DropDownList二级联动 为何子级DropDownList 显示不出来啊 求助! 你有把DropDownList2的AutoPostBack設為true嗎 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 要想实现联动必须把DropDownList的AutoPostBack属性设置true,这样才能回传服务器,获得数据 代码没错,应该是1楼的问题,或者SQL查询根本查不到数据不过建议DataSet用完要dispose()掉,占缓存资源 参考:http://download.csdn.net/source/331627http://download.csdn.net/source/282546 DataBind() 你这个函数时放在pageload里面的么,如果是,那么有没有写if(!this.page.ispostback){DataBind(); } 选择第一个DropDownList是否页面有刷新的迹象? <td style="text-align: right;">分类1:</td> <td style="width :220px;text-align: left"> <asp:DropDownList ID="ddlclass1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1" DataTextField="RSS_CLASS_NAME" DataValueField="RSS_CLASS_ID" Width="101px" OnSelectedIndexChanged="ddlclass1_SelectedIndexChanged" > </asp:DropDownList> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:RSSConnectionString %>" SelectCommand="SELECT RSS_CLASS_ID, RSS_CLASS_NAME, RSS_CLASS_SERIES, RSS_FATHER_ID FROM RSS_CLASS WHERE (RSS_FATHER_ID = @fatherID) AND (RSS_CLASS_SERIES = @seriesID) OR (RSS_CLASS_ID = @classID2) ORDER BY RSS_CLASS_ID" ProviderName="<%$ ConnectionStrings:RSSConnectionString.ProviderName %>"> <SelectParameters> <asp:Parameter DefaultValue="000" Name="fatherID" /> <asp:Parameter DefaultValue="1" Name="seriesID" /> <asp:Parameter DefaultValue="000" Name="classID2" /> </SelectParameters> </asp:SqlDataSource> </td> <td style="text-align: right">分类2:</td> <td style="width :220px;text-align: left"> <asp:DropDownList ID="ddlclass2" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2" DataTextField="RSS_CLASS_NAME" DataValueField="RSS_CLASS_ID" Width="101px" > </asp:DropDownList> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:RSSConnectionString %>" SelectCommand="SELECT RSS_CLASS_ID, RSS_CLASS_NAME, RSS_FATHER_ID, RSS_CLASS_SERIES FROM RSS_CLASS WHERE (RSS_FATHER_ID = @fatherID) AND (RSS_CLASS_SERIES = @series) OR (RSS_CLASS_ID = @classId2) ORDER BY RSS_CLASS_ID" ProviderName="<%$ ConnectionStrings:RSSConnectionString.ProviderName %>"> <SelectParameters> <asp:ControlParameter ControlID="ddlclass1" Name="fatherID" PropertyName="SelectedValue" /> <asp:Parameter DefaultValue="2" Name="series" /> <asp:Parameter DefaultValue="000" Name="classId2" /> </SelectParameters> </asp:SqlDataSource> </td> <td style="text-align: right">分类3:</td> <td style="width :210px;text-align: left"> <asp:DropDownList ID="ddlclass3" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource3" DataTextField="RSS_CLASS_NAME" DataValueField="RSS_CLASS_ID" Width="101px"> </asp:DropDownList> <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:RSSConnectionString %>" ProviderName="<%$ ConnectionStrings:RSSConnectionString.ProviderName %>" SelectCommand="SELECT RSS_CLASS_ID, RSS_CLASS_NAME, RSS_FATHER_ID, RSS_CLASS_SERIES FROM RSS_CLASS WHERE (RSS_FATHER_ID = @fatherID AND RSS_CLASS_SERIES = @seriesID) OR (RSS_CLASS_ID = @classId2) ORDER BY RSS_CLASS_ID"> <SelectParameters> <asp:ControlParameter ControlID="ddlclass2" Name="fatherID" PropertyName="SelectedValue" /> <asp:Parameter DefaultValue="3" Name="seriesID" /> <asp:Parameter DefaultValue="000" Name="classId2" /> </SelectParameters> </asp:SqlDataSource> *****************************************************************************欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html 你的 DropDownList2 selectindexchanged事件触发时,是否可以进入此事件对应的你写的函数 正则截取字符串 请教如何用T-sql搜索出html格式的内容中是否包含指定关键字 请教Repeater的使用,急! 使用微软的ajax, 如何在截入页面内容后再进行数据更新 对不起,VS2005,怎样在一个页面中改变另外一个页面的Label.text的值? 如何得到一个代理的返回值?! 在线急等,分不够再加! 正则,解决了立即给分 如何给超链接加入权限 报错“Server Error in '/' Application.” 问个ASP.NET问题,sValue[sValue.Length-1] 索引超出了数组界限。
不过建议DataSet用完要dispose()掉,占缓存资源
你这个函数时放在pageload里面的么,如果是,那么有没有写if(!this.page.ispostback){DataBind(); }
<td style="width :220px;text-align: left">
<asp:DropDownList ID="ddlclass1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1"
DataTextField="RSS_CLASS_NAME" DataValueField="RSS_CLASS_ID" Width="101px" OnSelectedIndexChanged="ddlclass1_SelectedIndexChanged" >
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:RSSConnectionString %>"
SelectCommand="SELECT RSS_CLASS_ID, RSS_CLASS_NAME, RSS_CLASS_SERIES, RSS_FATHER_ID FROM RSS_CLASS WHERE (RSS_FATHER_ID = @fatherID) AND (RSS_CLASS_SERIES = @seriesID) OR (RSS_CLASS_ID = @classID2) ORDER BY RSS_CLASS_ID"
ProviderName="<%$ ConnectionStrings:RSSConnectionString.ProviderName %>">
<SelectParameters>
<asp:Parameter DefaultValue="000" Name="fatherID" />
<asp:Parameter DefaultValue="1" Name="seriesID" />
<asp:Parameter DefaultValue="000" Name="classID2" />
</SelectParameters>
</asp:SqlDataSource>
</td>
<td style="text-align: right">分类2:</td>
<td style="width :220px;text-align: left">
<asp:DropDownList ID="ddlclass2" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"
DataTextField="RSS_CLASS_NAME" DataValueField="RSS_CLASS_ID" Width="101px" >
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:RSSConnectionString %>"
SelectCommand="SELECT RSS_CLASS_ID, RSS_CLASS_NAME, RSS_FATHER_ID, RSS_CLASS_SERIES FROM RSS_CLASS WHERE (RSS_FATHER_ID = @fatherID) AND (RSS_CLASS_SERIES = @series) OR (RSS_CLASS_ID = @classId2) ORDER BY RSS_CLASS_ID"
ProviderName="<%$ ConnectionStrings:RSSConnectionString.ProviderName %>">
<SelectParameters>
<asp:ControlParameter ControlID="ddlclass1" Name="fatherID" PropertyName="SelectedValue" />
<asp:Parameter DefaultValue="2" Name="series" />
<asp:Parameter DefaultValue="000" Name="classId2" />
</SelectParameters>
</asp:SqlDataSource>
</td>
<td style="text-align: right">分类3:</td>
<td style="width :210px;text-align: left">
<asp:DropDownList ID="ddlclass3" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource3"
DataTextField="RSS_CLASS_NAME" DataValueField="RSS_CLASS_ID" Width="101px">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:RSSConnectionString %>"
ProviderName="<%$ ConnectionStrings:RSSConnectionString.ProviderName %>" SelectCommand="SELECT RSS_CLASS_ID, RSS_CLASS_NAME, RSS_FATHER_ID, RSS_CLASS_SERIES FROM RSS_CLASS WHERE (RSS_FATHER_ID = @fatherID AND RSS_CLASS_SERIES = @seriesID) OR (RSS_CLASS_ID = @classId2) ORDER BY RSS_CLASS_ID">
<SelectParameters>
<asp:ControlParameter ControlID="ddlclass2" Name="fatherID" PropertyName="SelectedValue" />
<asp:Parameter DefaultValue="3" Name="seriesID" />
<asp:Parameter DefaultValue="000" Name="classId2" />
</SelectParameters>
</asp:SqlDataSource>
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html