Wrox Programmer Forums
|
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
 
Old August 11th, 2011, 06:38 AM
Authorized User
 
Join Date: Aug 2011
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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...
 
Old August 11th, 2011, 06:54 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 11th, 2011, 06:56 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 11th, 2011, 07:17 AM
Authorized User
 
Join Date: Aug 2011
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Default

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... :-)
 
Old August 11th, 2011, 07:53 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 12th, 2011, 12:43 AM
Authorized User
 
Join Date: Aug 2011
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Smile

Thanks Imar... I will prefer CompareValidator controll.....





Similar Threads
Thread Thread Starter Forum Replies Last Post
OntextChanged event of Textbox Emma Krystal ASP.NET 4 General Discussion 0 August 11th, 2011 06:17 AM
Textbox Leave Event Jewel142 BOOK: Visual Basic 2010 Programmer's Reference 3 April 22nd, 2011 04:42 PM
Modelpopupextender on textbox keypress event swathi reddy BOOK: Beginning ASP.NET 2.0 AJAX ISBN: 978-0-470-11283-0 0 April 26th, 2010 12:47 AM
TextBox Event davewoods Visual Basic 2005 Basics 3 October 10th, 2008 12:56 PM
SOLVED -- Overriding OnTextChanged of ComboBox dparsons C# 1 January 17th, 2007 02:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.