简体   繁体   English

编译器错误消息:CS0103:名称“绑定”在当前上下文中不存在

[英]Compiler Error Message: CS0103: The name 'Bind' does not exist in the current context

I'm having a problem accessing a property that I want to use as a condition on whether or not to display a particular element 我在访问要用作是否显示特定元素的条件的属性时遇到问题

<%if( (int)(Bind("DefaultAddress.AddressType"))==1)
{
%>
<td>
.....
....
</td>
<% }%> 

This gives: 这给出:

Compiler Error Message: CS0103: The name 'Bind' does not exist in the current context 编译器错误消息:CS0103:名称“绑定”在当前上下文中不存在

However elsewhere on the same .aspx page I have: 但是在同一.aspx页上的其他地方,我有:

<td class="return"  align="left">
                <asp:Label ID="Label9" Text='<%# Bind("DefaultAddress.Country") %>' runat="server" />
            </td>

which works perfectly. 完美地运作。 Note DefualtAddress is an instance of an Address object and Country and AddressType are properties of this object 注意DefualtAddress是一个Address对象的实例,Country和AddressType是此对象的属性

I also tried 我也试过

 <% if (DefaultAddress.AddressType==1)

but with the above code DefaultAddress is highlighted in red and when I hover over it I get the error message: Cannot resolve symbol 'DefaultAddress' 但是上面的代码DefaultAddress用红色突出显示,当我将鼠标悬停在上面时,收到错误消息:无法解析符号'DefaultAddress'

如果我没记错的话, Bind只能与<%#标记一起使用。(WebForms对我来说很久以前...)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 编译器错误消息:CS0103:当前上下文中不存在名称“ProtectedData” - Compiler Error Message: CS0103: The name 'ProtectedData' does not exist in the current context 编译器错误消息:CS0103:当前上下文中不存在名称“ listBox1” - Compiler Error Message: CS0103: The name 'listBox1' does not exist in the current context 编译器错误消息:CS0103:在当前上下文中不存在名称“网格” - Compiler Error Message: CS0103: The name 'grid' does not exist in the current context 错误 CS0103:当前上下文中不存在名称“_context” - Error CS0103: The name '_context' does not exist in the current context 错误 CS0103:当前上下文中不存在名称“currentScreen”(CS0103) - Error CS0103: The name 'currentScreen' does not exist in the current context (CS0103) 错误CS0103:名称“ TimeSpan”在当前上下文(CS0103)(testingProgram)中不存在? - Error CS0103: The name 'TimeSpan' does not exist in the current context (CS0103) (testingProgram)? 错误cs0103名称&#39;IEnumerator&#39;在当前上下文中不存在 - error cs0103 The Name 'IEnumerator' does not exist in the current context 错误CS0103:名称“ HttpUtility”在当前上下文中不存在 - error CS0103: The name `HttpUtility' does not exist in the current context "错误 CS0103:当前上下文中不存在名称“AssetPreview”" - error CS0103: The name 'AssetPreview' does not exist in the current context 错误CS0103当前上下文中不存在名称“图像” - Error CS0103 The name 'Image' does not exist in the current context
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM