2013-12-19 25 views
1

错误是:不能使用的ClientIDMode,各国缺少在构建集引用

'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="&lt;--Select Name--&gt;" /> 
    <asp:ListItem Value="0" Text="Name1" /> 
    <asp:ListItem Value="1" Text="Name2" /> 
</asp:DropDownList> 

我使用的.NET framework 4.0作为构建框架。

是否需要对web.config文件进行更改以使.NET能够识别该属性?

+0

告诉我们完整的标签 – Adil

+0

rambini

+0

对格式化Adil抱歉,但有整个DropDownList。这是非常标准和直接的,但我认为这是一个配置类型的问题,而不是代码。谢谢 – rambini

回答

0

我不认为你实际上使用4.0框架。右键单击该项目并转到属性。查看目标框架并将其切换到4.0或4.5

+0

谢谢克里斯,我已经检查和目标框架(属性页)是4.0 – rambini

+0

如果这是真的,那很可能这是一个转换后的项目,无法正确更新所有的引用。打开你的属性窗口并点击各种'System'参考来验证它们是否指向4.0版本。如果没有,修复它们。 – NotMe

+0

将相应地检查em。谢谢。 – rambini