C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Assigning the text value for a Password Textbox


Posted Date: 04 Oct 2005    Resource Type: Articles    Category: Web Applications
Author: Harish RanganathanMember Level: Gold    
Rating: Points: 10



Introduction



Setting the text property for a textbox with textmode=single and multiline is pretty straight forward by giving

TextBox1.Text = "The text we want to set";

However, if we set the Textmode property to Password, then we cannot simply set the text using the TextBox.text.

When do we need this ?


In practical scenarios, we may not want to set the password for obvious reasons that password is one which we retrieve from the user and it shoult not be set.

Also, even if we set some password, the user cannot read it as it is just a sequence of dots.

If, for however, due to specific reasons, we need to set the password, then we can do the same by using the following code:-


txtpasswd.Attributes.Add("value", "the password we wish to set");


Password Value from Database



Or, if you are assigning the password from the database you can use a DataReader in place of the actual password, as follows :

txtpasswd.Attributes.Add("value", objRdr["Password"].ToString());


Cheers.

Summary


In this article we discussed a simple example on how to set the Text Value for a TextBox with TextMode as Password.




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Including Search for your website documents -Part 2
Previous Resource: The Cool asp:xml control for displaying xml data.
Return to Discussion Resource Index
Post New Resource
Category: Web Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use