错误消息:当前上下文中不存在名称"xxx" [英] Error Message: The name 'xxx' does not exist in the current context
本文介绍了错误消息:当前上下文中不存在名称"xxx"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从设计器页面(源)中调用了函数GetPhotos()
. Getphotos()
在代码隐藏页中.
当我构建应用程序时,它运行良好,但是当我使用"fixedName and single page Assemblies"选项启用发布同一应用程序时,它将返回错误.
Hi,
I have called a Function GetPhotos()
from Designer Page (source). Getphotos()
is in Code-behind Page.
It runs well when I build the application but when I publish the same application using "fixedName and single page Assemblies" option Enable, it returns an error.
Compiler Error Message: CS0103: The name ''GetPhotos'' does not exist in the current context.
我该怎么办?
设计页面中的代码:
What should I do?
Code in Design page :
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Panel ID="pn1" runat="server" GroupingText="Facility''s">
<table width="100%">
<tr>
<td style="text-align: removed">
<asp:Label ID="Label2" runat="server" Height="100%"
style="font-size: 21pt; font-weight: 700; color: #996633" Width="100%">
</td>
</tr>
<tr><td style="text-align: removed"><asp:Label ID="Label3" runat="server"
style="text-align: justify"></td></tr>
<tr>
<td>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px"
CellPadding="4" PageSize="15" Width="100%"
onselectedindexchanged="GridView1_SelectedIndexChanged">
<rowstyle backcolor="White" forecolor="#333333" />
<footerstyle backcolor="White" forecolor="#333333" />
<pagerstyle backcolor="#336666" forecolor="White" horizontalalign="Center" />
<SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
<%
GetPhotos(Label2.Text);
%>
</td>
</tr>
</table>
预先感谢.
Thanks in advance.
推荐答案
函数GetPhotos应该是 public .
Function GetPhotos should be public.
这篇关于错误消息:当前上下文中不存在名称"xxx"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文