简体   繁体   English

当前上下文中不存在文本框

[英]Textbox does not exist in current Context

I am sure this question comes up a lot, but I didn't find an answer in your archives. 我确信这个问题很多,但我没有在你的档案中找到答案。 Here is my ASP code: 这是我的ASP代码:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RCC_ChangePassword.ascx.cs" Inherits="Regal.Web._Tester.RCC.RCC_ChangePassword" %>
    <div id="modal-password-change">
        <div class="modal-contents">

            <h1>Change Password</h1>
            <div class="intro">Use the form below to change the password for your RCC account. Use the new password next time you log in.</div>

            <asp:Label ID="CurPass" Text="Current Password" runat="server"></asp:Label>
            <asp:Textbox  id="CurrentPass" runat="server" CssClass="required"></asp:Textbox>

            <asp:Label ID="NwPass" Text="New Password*" runat="server"></asp:Label>
            <asp:Textbox  id="NewPass" runat="server" CssClass="required"></asp:Textbox>

            <asp:Label ID="CnfPass" Text="Confirm Password" runat="server"></asp:Label>
            <asp:Textbox  id="ConfirmPass" runat="server" CssClass="required"></asp:Textbox>

            <h4>Your password must include ALL of the following</h4>
            <ul class="notes">
                <li>At least 8 characters (not more than 16 characters)</li>
                <li>At least one number</li>
            </ul>

            <asp:Button ID="submit" Cssclass="btn blue wide" runat="server" Text="Save Changes" OnClick="btnSubmit_click"></asp:Button>

        </div>

    </div><!-- #modal-password-change .modal -->

And here is the line that I am getting the error on: 以下是我收到错误的行:

 // Change actual password for the new password    
                        String testPass1 = NewPass.Text;    
                        if (regalMemberRepo.ChangePassword(oUser.Email, oUser.Password, testPass1))

can you see anything odd about my code? 你能看到我的代码有什么奇怪之处吗? Thank you in advance. 先感谢您。

This happens to me often with VS. 这经常发生在我身上。 Take a look in the designer file and see if VS created an entry in there for the text box? 看看设计器文件,看看VS是否在那里为文本框创建了一个条目? Make sure you don't have another file somewhere with a similar declaration. 确保您没有其他具有类似声明的文件。

Many times, best way to fix this is to delete, re-create and re-name the form. 很多时候,解决此问题的最佳方法是删除,重新创建和重命名表单。 We're not supposed to edit the designer file ourselves. 我们不应该自己编辑设计器文件。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM