Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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 November 2nd, 2006, 02:04 AM
Registered User
 
Join Date: Nov 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem in <asp:TextBox>

i hav defined the server control <asp:TextBox>
and hav set its default text value to "enter your name"
now..what i want is...that on clicking this text box.....for entering name...the default value already present there disappears....

plz guide me as a newcomer in asp.net....
tx....

 
Old November 2nd, 2006, 11:02 AM
Authorized User
 
Join Date: Nov 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to davidrodrigues40
Default

You would need to do this with a client script.
Replace the value == "Enter Your Name" with the default text

<script type="text/javascript">
    function resetMe(obj,value){
        if (value == "Enter Your Name"){
            obj.value= ""
        }
    }
</script>

In the page load place this code

UserName.Attributes.Add("onfocus", "resetMe(this,this.value)")

let me know if this works for you.

 
Old November 3rd, 2006, 12:02 AM
Registered User
 
Join Date: Nov 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

perfect .......this works.....tx......






Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 8: <asp:image> inside <a> & ext.CSS (pg. 274) epc BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 July 12th, 2008 04:37 AM
a problem in book<<beginning asp.net using vb>> luoware ASP.NET 1.0 and 1.1 Basics 3 December 8th, 2003 09:32 PM
<<ASP.NET Security>>,download files in chapter 8 alaix All Other Wrox Books 1 July 24th, 2003 10:29 AM





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