changepassword控件的问题 [英] problem with changepassword control
本文介绍了changepassword控件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的网络表单中使用带有6个标签的ajaxtabcontrol,在一个标签中我已经放置了changepassword控件。
,当我获得值时,代码落后对于confirmnewpassword,它给出的错误为:changepassword1在当前上下文中不存在。
这里是设计代码
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
<ajax:TabPanel ID="tbpnlsetting" runat="server" ><HeaderTemplate>
Settings
</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
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();
}
}
推荐答案
如果控件名称不可用或重复,则会出现此错误
步骤1:
转到Designer视图,在那里看到表单和控件,单击Changepassword1control并查看属性它(可按F4),如果名称正确
转到aspx.cs
按CTRL + F = Changepassword1搜索整个页面的重复项,如果找到则删除重复项。
建议:请遵循正确的命名约定,以便这些错误可以是最小化。
最好的:)如果你需要更多的帮助,请回信
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
这篇关于changepassword控件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文