有关从VWDeveloper声明标签和错误的问题 [英] question about declaring labels and errors from VWDeveloper

查看:76
本文介绍了有关从VWDeveloper声明标签和错误的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我向我的页面添加标签时,如下所示:


< asp:Label id =" Message"文本= QUOT;" Runat =" Server" />


和这样的代码:

Sub Page_load(s As Object,e As EventArgs)

Message.Text ="无论什么

结束sub


我从Visual Web Developer收到一条错误警告:姓名'消息'未被声明


如何声明asp:标签?

When I add a label to my page like this :

<asp:Label id="Message" Text="" Runat="Server"/>

and code like this:

Sub Page_load( s As Object, e As EventArgs )
Message.Text = " whatever "
End sub

I get a error warning from Visual Web Developer that says "Name ''Message'' is not declared"

how do I declare the asp:label ?

推荐答案

如果你手动完成,那么就会有代码中没有声明

在课后,因此你的代码不会看到它。

使用设计器添加代码。如果你没有设计师,那么你需要在类级别的代码中声明这个。


Protected WithEvents lblMessage As System.Web.UI。 WebControls.Label


请记住,你的aspx页面实际上是一个类模板,它继承了

类后面的代码,如果你查看你的页面声明aspx

页面顶部你会看到这个。


HTH

-

Best问候


无与伦比的Mr Newbie o?o

" Jon Paal" < Jon nospam Paal @ everywhere dot com>写在消息

新闻:e3 ************** @ TK2MSFTNGP11.phx.gbl ...
If you did this manually, then there would be no declaration in the code
behind class and therefore your code would not see it.
use the designer to add the code. If you dont have a designer, then you
will need to declare this in code behind at class level

Protected WithEvents lblMessage As System.Web.UI.WebControls.Label

Remember, your aspx page is actually a class template which inherits from
the code behind class, if you look in the page declarations on your aspx
page at the top you will see this.

HTH
--
Best Regards

The Inimitable Mr Newbie o?o
"Jon Paal" <Jon nospam Paal @ everywhere dot com> wrote in message
news:e3**************@TK2MSFTNGP11.phx.gbl...
当我添加标签时我的页面是这样的:

< asp:Label id =" Message"文本= QUOT;" Runat =" Server" />

和这样的代码:

Sub Page_load(s As Object,e As EventArgs)
Message.Text =" ;什么
结束子

我从Visual Web Developer收到错误警告,上面写着姓名'消息''
未被声明

如何声明asp:label?
When I add a label to my page like this :

<asp:Label id="Message" Text="" Runat="Server"/>

and code like this:

Sub Page_load( s As Object, e As EventArgs )
Message.Text = " whatever "
End sub

I get a error warning from Visual Web Developer that says "Name ''Message''
is not declared"

how do I declare the asp:label ?



有趣。这似乎是一个VWD的东西,它有一个设计师,但我手动将所有内容添加到源页面。


我也没有使用代码,这是有效的VWD中的选项。因此,当我将标签从工具箱拖到源页面(或

设计页面)时,VWD不会自动添加任何其他内容。


但是,当我将代码从工具框拖到页面中,然后手动添加脚本代码,不会出现错误消息。


去图........
interesting. This appears to be a VWD thing, which does have a designer, but I added everything manually into the source page.

I also don''t use code behind, which is a valid option in VWD. So, when I drag the label from the toolbox into the source page (or
design page) VWD does not automatically add anything else.

However, when I drag the code into the page from the tool box, then add the script code manually, the error message does not appear.

Go figure........


通过VWD,你的意思是什么?


在任何情况下,为了解决一个类成员,它必须是

首先声明,这是不言而喻的。我不是真的

确定你的设置是如何配置的以及你使用的是什么工具所以它很难实现。

-

最好的问候


无与伦比的Mr Newbie o?o

" Jon Paal" < Jon nospam Paal @ everywhere dot com>在消息中写道

新闻:%2 *************** @ TK2MSFTNGP14.phx.gbl ...
By VWD, you mean what ?

In any case, in order to address a class member, it must be have been
declared in the first place, this goes without saying really. I''m not really
sure how your setup is configured and what tools you are using so its a
little difficult.
--
Best Regards

The Inimitable Mr Newbie o?o
"Jon Paal" <Jon nospam Paal @ everywhere dot com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
有趣。这似乎是一个VWD的东西,它有一个设计师,
但我手动将所有内容添加到源页面。

我也没有使用后面的代码,这是有效的VWD中的选项。所以,当我将标签从工具箱拖到源页面(或设计页面)时,VWD
不会自动添加任何其他内容。

然而,当我拖动代码时从工具箱进入页面,然后手动添加脚本代码,不会出现错误信息。

去图........
interesting. This appears to be a VWD thing, which does have a designer,
but I added everything manually into the source page.

I also don''t use code behind, which is a valid option in VWD. So, when I
drag the label from the toolbox into the source page (or design page) VWD
does not automatically add anything else.

However, when I drag the code into the page from the tool box, then add
the script code manually, the error message does not appear.

Go figure........



这篇关于有关从VWDeveloper声明标签和错误的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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