Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-08-22
7
Medium Priority
?
864 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 2000 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 2000 total points
ID: 33495637
Have you set AutoPostback="true"?

<asp:TextBox id="SomeTextBox" runat="server" AutoPostback="true" />
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 2000 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

782 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