Solved

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

Posted on 2010-08-22
7
850 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

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

Industry Leaders: 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!

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 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