Solved

How do I access the codebehind of a formview textbox lostfocus event

Posted on 2010-08-22
7
836 Views
Last Modified: 2012-05-10
Hi

I have a formview control with a textbox.  When the user types a value into the textbox, I need to access a database and retrieve some values, in order to populate other textboxes in the same formview.

Is it possible to write the data access code in the codebehid of the textbox lostfocus event, and then populate the other textboxes?
0
Comment
Question by:C_Newbe
  • 4
  • 3
7 Comments
 
LVL 10

Accepted Solution

by:
Espavo earned 500 total points
ID: 33495123
Dunno about on TextBox LostFocus...
You could do this, which will trigger does trigger when you esentially loose focus...
Protected Sub SomeTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles SomeTextBox.TextChanged
'Do stuff here...
End Sub
Espavo
0
 

Author Comment

by:C_Newbe
ID: 33495544
Hi

Thanx for the response.  The problem is, that the textchanged event is not fired??  Why would that be?
0
 
LVL 10

Assisted Solution

by:Espavo
Espavo earned 500 total points
ID: 33495637
Have you set AutoPostback="true"?

<asp:TextBox id="SomeTextBox" runat="server" AutoPostback="true" />
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:C_Newbe
ID: 33496257
It is working, sort of.  Just have a problem using the textchanged event, cause if I populate the textbox from a javascript, and ten <tab> off the textbox, the code is not fired.

Any other suggestions?
0
 
LVL 10

Assisted Solution

by:Espavo
Espavo earned 500 total points
ID: 33496369
You could (could you?) trigger the event when you populate the textbox...
What I'm suggesting is that whatever event is populating the textbox, could also run the code... (No?)
BTW, what could be setting the value of the textbox, other than a user?
0
 

Author Comment

by:C_Newbe
ID: 33499595
Thanx for your replies.  I got it working.  A cardswipe machine is actually setting the value of a textbox.  A clientscript calls a dll to initialise the "pinpad" and then "read" the number into the textbox.
0
 

Author Closing Comment

by:C_Newbe
ID: 33530981
Thanx for all the help
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now