Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8835407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:15:16+00:00 2026-06-14T09:15:16+00:00

I have a asp page and i have filter textboxes at the top. These

  • 0

I have a asp page and i have filter textboxes at the top. These 3 textboxes render with text in them(saying what to enter). I already have code added to select all text when the textbox gains focus but now i need to in a sense do the exact opposite when the control loses focus. The goal here is to make the textbox filters be filled with the default text at all times, except for when the user has entered a valid filter value.

Basically

if the control.text = string.empty and control.lostfocus then
set text back to “default”
end if

So far i have this code at page load…

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not IsPostBack Then
        txtAcctFilter.Attributes.Add("onFocus", "JavaScript:this.select();")
        txtMonthFilter.Attributes.Add("onFocus", "JavaScript:this.select();")
        txtYearFilter.Attributes.Add("onFocus", "JavaScript:this.select();")
        'txtAcctFilter.Attributes.Add("onBlur", )
        'txtMonthFilter.Attributes.Add("onBlur", txtMonthFilter.Text = "Enter Month")
        'txtYearFilter.Attributes.Add("onBlur", txtYearFilter.Text = "Enter Year")
        Populate()
    End If
End Sub

The 3 lines commented out are my attempts but i believe their is an issue between the properties being reverted on the control. I’m a noobie at javascript so not sure exactly whats going on there. Any ideas of how i can get this simple logic to work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:15:18+00:00Added an answer on June 14, 2026 at 9:15 am

    It would be something along the lines of this:

    txtMonthFilter.Attributes.Add("onBlur", "javascript: if (this.value == """") {this.value = ""Enter Month""}")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 3 filter textboxes on my asp.net page. Each textbox is assigned 2
I have asp label in my asp page and its text is some my
I have an ASP page which displays a text box when it loads. It
I have to filter user input to on my web ASP.NET page: <asp:TextBox runat=server
I have a ASP.Net web page with a grid view. I want to filter
I have an ASP .Net page with a radio button group and a text
I have a devexpress gridview within my asp.net page which has a filter row.
I have ASP.NET page with an iframe on it for displaying some pdf reports
I have ASP.NET page, it calls webservice via $.ajax and returns result in json
I have an asp page in which the are number of listboxes.I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.