473,749 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to clear textbox value when textbox clicked in asp.net, c#

2 New Member
hi, my textbox contains text as "search" on pageload when the user click the textbox the text "search" should disappear and the textbox must get the value of the user entering text. please help the guide for this event in asp.net c#
Jun 21 '07 #1
2 4740
r035198x
13,262 MVP
hi, my textbox contains text as "search" on pageload when the user click the textbox the text "search" should disappear and the textbox must get the value of the user entering text. please help the guide for this event in asp.net c#
Hi and welcome to TSDN. Hope you'll have a great time here. I'll move this to the .NET forum where the experts there can help out.
Jun 21 '07 #2
nateraaaa
663 Recognized Expert Contributor
hi, my textbox contains text as "search" on pageload when the user click the textbox the text "search" should disappear and the textbox must get the value of the user entering text. please help the guide for this event in asp.net c#
You can do this using javascript or you can use the onTextChanged event of the textbox to clear the text within your textbox. I am assuming there is a button also on your page to execute the search. In the click event of your button you will want to check to see if the text in your textbox is = to "search" if not then pass this value to your stored procedure to execute your search.

Nathan
Jun 21 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
8579
by: Paul M. Frazier, Ph.D. | last post by:
I am writing a user information update page and I populate the form on Page_Load with the current values of the user's name, etc. When I change the text in one of the textbox controls (e.g., change the user's middle initial from M. to X.) and submit the form, the value seen for middleinitial.text in the Public Sub that is executed when the Update button is clicked is the initial value (M.) and not the new value (X.). Is there something I...
2
2567
by: buran | last post by:
Dear ASP.NET Programmers, I have a question about a script I'm trying to code and invoke when a button (btnSave) is pressed on the page. This script should only run when a textbox (txtAD) on the page is left blank. I tried to use a code snippet with the "return confirm" function but without success. The code should check whether the textbox is empty or not, and if empty, it should ask the user to continue and then run the next code. How...
2
2101
by: wrytat | last post by:
I have a datagrid and I created a textbox and a button in a column of every row. How do I make it such that when the user click the button, i can get the value entered in the textbox, and how do I know which row are the textbox and the button that is clicked located? And how do I include the button_Click event in my code? Does anyone has any idea? Thank you.
4
2705
by: Samy | last post by:
Hi There, I have a user control with a textbox and a button which when clicked opens a calendar control(calendar.aspx page). When I select a date from the calendar control, the date is supposed to be populated in the textbox. I use the user control on a index.aspx page. In order to achieve this I have a selected intexchange event on the calendar control. I pass the textbox id using the querystring when the button is clicked and then...
11
7763
by: Joe | last post by:
Hello All, I have an ASP.NET page with one Textbox (SearchTextBox) and one ImageButton (SearchButton) server controls. The user can type search text in SearchTextBox and click SearchButton and the web server performs a database query and displays the results. All of this works fine. I want the user to be able to press the Enter key while the cursor is still in SearchTextBox and have the SearchButton.Click event fire (thus performing...
1
3230
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' & 'Cancel'). Till this point, no problem. Initially, the TextBox is empty. The Button has a property named 'ConfirmMessage' so that the developer using this custom control can modify the question in the confirm dialog. If the user clicks 'OK', I want the...
3
3741
by: rn5a | last post by:
A DataGrid has a BoundColumn, an EditCommandColumn & a few TemplateColumns. When the text in the EditCommandColumn within any of the DataGridItems is clicked, the corresponding BoundColumn changes to a TextBox. How do I get the ID of such a TextBox?
5
15153
by: Kulgan | last post by:
Hi all, Is it possible in javascript to add a textbox when the last of three radiobuttons is clicked ? thanks !
3
10492
by: AlecL | last post by:
Hi All, I am trying to capture the value of a textbox as a result of a button click event in a repeater, but it can't find the textbox. Here is what I am trying to do in the code for the click event: Dim prodkey As String = CType(FindControl("txtProductkey"), TextBox).Text.ToString() Response.Redirect("store_shoppingcart.aspx?pkey=" & prodkey)
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8256
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6800
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.