BC30260错误 - 已经声明了? [英] BC30260 error - already declared?
问题描述
你好
当我通过浏览器预览我的Register1.aspx(WebSite11)页面时,我收到以下来源错误:
Hello
When I preview my Register1.aspx (WebSite11) page through a browser I get the following source error:
Dim strEmail As Object
There is no line in my aspx or aspx.vb file that states: Dim strEmail As Object
Compiler Error Message: BC30260: 'strEmail' is already declared as 'Protected WithEvents strEmail As System.Web.UI.WebControls.TextBox' in this class.
我认为错误所指的字段是:
The field I think the error is referring to is this:
<div class="form-group">
<asp:Label runat="server" AssociatedControlID="strEmail" CssClass="col-md-2 control-label">Email</asp:Label>
<div class="col-md-10">
<asp:TextBox runat="server" ID="strEmail" TextMode="Email" CssClass="form-control" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="strEmail"
CssClass="text-danger" Display="Dynamic" ErrorMessage="The email field is required." />
<asp:RegularExpressionValidator runat="server" ControlToValidate="strEmail"
CssClass="text-danger" Display="Dynamic" ErrorMessage="Please enter a valid email address."
ValidationExpression="^.+@.+$" />
</div>
</div>
我已将TextMode从strEmail更改为电子邮件,但它没有任何区别。我不太确定TextMode所指的是什么。
任何帮助都会受到赞赏。
I have changed the TextMode from strEmail to just Email, but it has made no difference. I'm not too sure what TextMode refers to.
Any help would be appreciated.
推荐答案
/>
< / div>
< / div>
" /> </div> </div>
我已经将TextMode从strEmail更改为只是电子邮件,但它没有任何区别。我不太确定TextMode所指的是什么。
任何帮助都将不胜感激。
I have changed the TextMode from strEmail to just Email, but it has made no difference. I'm not too sure what TextMode refers to.
Any help would be appreciated.
将id更改为其他内容
例如更改
change the id to something else
for example change
ID="strEmail"
to
to
ID="stringEmail"
您可能需要更改指向此文本框的所有验证器以及所有对新ID的引用后面的代码。
或重构 - 将对象重命名为其他名称对你来说很容易
you may need to change all the validators which pointing to this textbox and also in the code behind all references to new id.
Or refactor - rename below object to some other name. it will be easy for you
Dim strEmail As Object
to
to
Dim stringEmail As Object
这篇关于BC30260错误 - 已经声明了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!