构建时出错:
'System.Web.UI.WebControls.DropDownList' does not contain a definition for 'ClientIDMode' and no extension method 'ClientIDMode' accepting a first argument of type 'System.Web.UI.WebControls.DropDownList' could be found (are you missing a using directive or an assembly reference?)
代码是:
<asp:DropDownList ID="cbNames" ClientIDMode="Static" runat="server">
<asp:ListItem Value="" Text="<--Select Name-->" />
<asp:ListItem Value="0" Text="Name1" />
<asp:ListItem Value="1" Text="Name2" />
</asp:DropDownList>
我使用.NET framework 4.0作为构建框架。
为了使.NET能够识别属性,我需要对web.config文件进行更改吗?
答案 0 :(得分:0)
我认为你实际上并没有使用4.0框架。右键单击项目并转到属性。查看那里的目标框架并将其切换为4.0或4.5