Solved

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

Posted on 2010-08-22
7
841 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

948 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

23 Experts available now in Live!

Get 1:1 Help Now