lblmessage在当前上下文中不存在 [英] lblmessage doesn't exist in the current context

查看:256
本文介绍了lblmessage在当前上下文中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮帮我..



标签在UI中有id ..但在代码后面如果我使用标签的id ...它是显示错误说lblmessage在当前上下文中不存在..

please help me out..

The label has id in the UI.. but in code behind if i use the id of label...it is showing error saying lblmessage doesn''t exist in the current context..

<asp:Label runat="server" ID="lblMessage" Text="" class="multi">





如果我在后面的代码中使用上面的id我得到错误



if i use the above id in code behind am getting error

lblMessage.Text += fileName + "Uploaded";

推荐答案

您可能缺少结束标记:你有没有删除结尾的斜杠?

Probably, you are missing the closing tag: Have you deleted the slash from the end?
<asp:Label runat="server" ID="lblMessage" Text="" class="multi">

成为

Becomes

<asp:Label runat="server" ID="lblMessage" Text="" class="multi"/>


如果您没有错过结束标签检查是否啦bel具有与您尝试在.cs文件中使用的相同ID。

否则删除此添加新标签给它一个不同的名称'''并构建解决方案,之后使用它。 cs文件
if you are not missing the closing tag check if label has same id as you are trying to use in .cs file.
otherwise delete this add a new label give it a different name '''' and build the solution and after that use it in .cs file


构建您的网站,然后在代码后面使用标签。有时它可以工作。
build your website once then use label in code behind. sometimes it works.


这篇关于lblmessage在当前上下文中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆