 |
| ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 11th, 2011, 06:38 AM
|
|
Authorized User
|
|
Join Date: Aug 2011
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
OntextChanged Event of textbox
hi,
I am having a simple doubt about textchanged event of texbox...
When I am firing textbox event "textchanged" then it is automatically get blank...
for eg, If i enter a "emma" in the textbox and press 'enter' key then the texbox doesnt get blank.
But when i enter password character (****) into texbox and pressing 'tab' or'enter' key then it get blank auotomatically....
I want same entered password character to be in the textbox even if textchanged event is fired...
Waiting for your solution...
thanks in advance...
|
|

August 11th, 2011, 06:54 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Can you post your code (both the HTML / ASPX markup as well as the code behind you may have)? You typically don't fire the OnTextChanged event yourself, the control fires it and you can respond to it. Maybe you're resetting something in this event?
Imar
|
|

August 11th, 2011, 06:56 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
OH, BTW, I think I see what the problem is. Password controls don't maintain their values after a postback. For more information: http://forums.asp.net/t/1267557.aspx...after+postback+
Imar
|
|

August 11th, 2011, 07:17 AM
|
|
Authorized User
|
|
Join Date: Aug 2011
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Yea u are right... i m not firing the event, it is invoked automatically....
this is the CS code i m writing incide event
protected void txt_confirmPwd_TextChanged(object sender, EventArgs e)
{
if (txt_pwd.text!= txt_confirmpwd.text)
{
lbl_PwdMsg.Text = "password not matched";
}
}
BTW I guess the problem is due to same reason that you gave...
"Password controls don't maintain their values after a postback."...
thanks for your great response... :-)
|
|

August 11th, 2011, 07:53 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
On a side note, I wouldn't write this myself, but use the CompareValidator instead. Or better yet, use the CreateUserWizard if it's supported by your requirements.
Cheers.
Imar
|
|

August 12th, 2011, 12:43 AM
|
|
Authorized User
|
|
Join Date: Aug 2011
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Thanks Imar... I will prefer CompareValidator controll.....
|
|
 |