先说明一下,我的页面用到了母版页,dropdownlist是在formview中的,和dropdownlist绑定的datasource是在页面中的另一个<fieldset>中的,我已经使用了UniqueID,因为是三层,所以使用了BusinessLogicLayer组件和DataAccessLayer组件前台:
<tr>
<td width="160px"><li><b><asp:Label ID="lblEditCategory" Text="分类:" AssociatedControlID="ddlEditCategory" runat="server" /></b></li></td>
<td width="450px"><asp:DropDownList ID="ddlEditCategory" Width="210px" 
DataSourceID="ctl00$ctl00$middleContentPlaceHolder$materialLeftContentPlaceHolder$ObjDataSrcCategory" 
DataTextField="CategoryName" DataValueField="CategoryId" 
SelectedValue ='<%#Eval("CategoryId")%>' runat="server"> 
</asp:DropDownList></td>                           
</tr> 在网上找了很多,都没解决,希望高手解惑

解决方案 »

  1.   

    dropdownlist的绑定用得着这么复杂吗
    一个简单的绑定就行了
      

  2.   

    从问题上看是SelectedValue ='<%#Eval("CategoryId")%>'绑定的值
    在asp:DropDownList中没有。
    你先去掉SelectedValue ='<%#Eval("CategoryId")%>'个。看asp:DropDownList中有什么值。
    再看下当前Eval("CategoryId")的值是多少。做比较,
      

  3.   

    你怎么不在CS代码里写了
    this.dropdownlistid.datasource=...
    ..
    类似这样的
      

  4.   

    一个DropDownList绑定这么弄的那么纠结....