求助:如何确定Datalist中的DropDownList的数据源并绑定?
我用了一个DataList来显示数据。在DataList.HeaderItemplate中,我用了一个DropDownList控件,但是DropDownList.DataSourse与DataList.DataSourse不同,我怎么才能分别设置他们的DataSourse?
我的做法是:<asp:dropdownlist id="DropDownList1" DataTextField="City" DataSource='<%# areaSourse %>' DataValueField="City" runat="server" OnSelectedIndexChanged="DropDownList1_OnSelectedIndexChanged"></asp:dropdownlist>然后我在Page_Load()中初始化areaSourse
而DataList则是在页面的后台cs文件里面设置并绑定的。
这样DropDownList依然没有数据,而数据库本身是有数据的。为什么不行?我该怎么做?
谢谢!!