textbox lost focus in aspnet

W

Wanda

I would like to get a lostfocus even in aspnet, I know I can do
something like that:

txtBox.Attributes.Add("onblur", "javascript:RunMe()")

But then the scirpt, RunMe has to be written in the html page, which
can be viewed by the user.

I want to keep the code in the aspx.vb (hiding the code from the
user), as I am going to retreive some data from the database, then....

1. Can the function or sub be placed at aspx.vb? If yes, how can I
call the function
2. If not, how can I hide my code from the user, as they can user
"View Source"...

Thanks in advance. Any help would be greatly appreciated
Wanda
 
K

Kevin Spencer

Hi Wanda,

You know, there's a fish named afer you. ;-)

I believe you're mixing up server-side and client-side functionality here.
Your HTML document on the client is your interface. The classes and
processing on the server are the business logic. When you say:
I want to keep the code in the aspx.vb (hiding the code from the
user), as I am going to retreive some data from the database, then....

You're mixing up server-side and client-side functionality. Fetching data
from a database is something that happens on the server, where nobody can
see it. Anything that ahppens on the client, such as handling an HTML
object's onblur event, is purely interface stuff. There isn't any logical
connection between the 2. How is running a client-side event handler going
to expose something you don't want exposed from the server?

At any rate, client-side event handling is on the client, and must be done
via JavaScript, which must be downloaded by the browser. Once downloaded,
there's little you can do to hide it from the user. You could put your
JavaScript functions into a .js file which you reference in your page, but
of course, that .js file is downloaded by the browser as well (or it
couldn't run it), and is therefore, available with a little work on the part
of the user, digging around in their Temporary Internet Files folder.

Bottom line: Hiding your HTML source code is a pointless and fruitless
endeavor. The server-side code will never be seen by the client anyway, and
that is what really matters.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top