Results 1 to 4 of 4

Thread: [2008] Lost Focus on Text Box

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    240

    [2008] Lost Focus on Text Box

    Hi Guys,

    Anyone here knows how to program this:
    For example I have a textbox asking for a name, and automatically after I have entered my name and lost my focus on that textbox it will automatically check the database if my name does already exists or not?

    Thanks in advance!

    By the way I am using ASP.NET and C#.

  2. #2
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: [2008] Lost Focus on Text Box

    You could use Javascript (or AJAX) to postback to the page on the javascript onblur event of the textbox.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    240

    Re: [2008] Lost Focus on Text Box

    I am not good at javascript is there anyway to use c#.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2008] Lost Focus on Text Box

    I think you'll have to take the plunge and learn javascript for this, users are not going to appreciate the sudden postback that occurs without their consent.

    It's not as difficult as you think - have a look at ASP.NET AJAX. You'll probably need to define an UpdatePanel and have your code call a method on your page which in turn uses C# to check the database. Your C# method will return a value to the javascript and the javascript can then use that value to determine what to do next - warn the user, for example.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width