Click here to Skip to main content
15,922,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
in my web form am using ajaxtabcontrol having 6 tabs, in one tab i have placed changepassword control.
with in code behind when i get the value of confirmnewpassword , it's giving error as: changepassword1 doesnot exist in the current context.

here is the code for design

ASP.NET
<ajax:TabPanel ID="tbpnlsetting" runat="server" >&lt;HeaderTemplate>

 Settings

    &lt;/HeaderTemplate>

    <ContentTemplate>



    <asp:Panel ID="settings" runat="server" Width="671px" Height="214px">

        <asp:ChangePassword ID="ChangePassword1" runat="server"
            onchangedpassword="ChangePassword1_ChangedPassword" PasswordLabelText="Current Password"">
        </asp:ChangePassword>

 </asp:Panel>


    </ContentTemplate>


</ajax:TabPanel>
</ajax:TabContainer></pre></pre>


and code behind is

C#
protected void ChangePassword1_ChangedPassword(object sender, EventArgs e)
       {
           using (MySqlConnection con = new MySqlConnection(ConnectionString))
           {
               String query = "update  admin set Password ='" + ChangePassword1.ConfirmNewPassword + "' where  Password ='" + ChangePassword1.CurrentPassword + "'";
               MySqlCommand command = new MySqlCommand(query,con);
               con.Open();
               command.ExecuteNonQuery();
           }
       }
Posted
Updated 23-Jan-14 18:07pm
v3

1 solution

This Error Occurs if the control name is not available or duplicated

Step1:
Go to the Designer view, where you see the form and controls , click on the Changepassword1control and look at the properties of it (can press F4),if the name is correct

Go to aspx.cs

press CTRL+F =Changepassword1 search the entire page for duplicates, if found remove the duplicates.

Suggestion:pls follow proper naming conventions ,so that these kind of errors can be minimized.

All the best:)pls write back if you need more help
 
Share this answer
 
v2
Comments
Member 10263519 24-Jan-14 1:16am    
ichecked it , but i googled i requires membership...., but i don't know about that so am solving it by without using ChangePassword Control

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900