|
-
Nov 28th, 2008, 06:30 AM
#1
Thread Starter
Addicted Member
[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#.
-
Nov 28th, 2008, 09:43 AM
#2
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.
-
Nov 28th, 2008, 08:44 PM
#3
Thread Starter
Addicted Member
Re: [2008] Lost Focus on Text Box
I am not good at javascript is there anyway to use c#.
-
Nov 30th, 2008, 09:40 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|