如何给 FormView控件中得DropDownList绑定数据源?
如何给 FormView控件中得DropDownList绑定数据源?
用代码绑定也报错!
DataBinding:“OfficeChannel.DAL.UserList”不包含名为“MapDisplayText”的属性。
我的代码!
用控件访问DAL层得方法出错
    public IQueryable JobID1()
         {
             DALDataContext ocDC = new DALDataContext(ConfigurationManager.ConnectionStrings["OfficeChannelConnectionString_Web"].ConnectionString);
             var UserInfo = from UL in ocDC.CommonMapList
                            where UL.TypeFlag == 1
                            select UL.MapDisplayText;
             return UserInfo;
或者pageload中直接绑定也出错
DropDownList IndustryID = (DropDownList)FormView1.FindControl("IndustryID");
                     IndustryID.DataSource = from cml in ocDC.CommonMapList
                                        where 1 == cml.TypeFlag
                                        select cml;
前台代码
<asp:DropDownList ID="IndustryID" runat="server"                                          
                                         SelectedValue='<%# Bind("MapDisplayText") %>'  Width="66px"  
                                   >
                                     </asp:DropDownList>
------解决方案--------------------
  SelectedValue=' <%# Bind("MapDisplayText") %>'  Width="66px"  
把这个删除了,就因为他,给他绑定最好用代码绑