473,378 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Javascript and PostBack on one TextBox

Hi, All

I have a textbox for user to input SSN, I havea javascript to format
what he input to SSN format, I also have a onChange postback function
to retrieve other info based on the SSN.
<asp:TextBox id="txtSSN" runat="server" AutoPostBack="true"
onKeyDown="javascript:myJavaFunction"></asp:TextBox>

in code behind
protected void SSN_OnTextChanged(object sender, System.EventArgs e)
{
//do database query
}

The OnTextChanged event triggered correct if I do not have the
OnKeyDown Javascript. But if I put the onKeyDown javascript. then the
OnTextChanged event won't get triggered.

Can I put both JavaScript and postback function on one control? If so,
what I did wrong or is there another work around?

Thanks a lot
-Rockdale

Jun 27 '06 #1
2 2461
Try

onKeyDown="return myJavaFunction()"

and make myJavaFunction return true.

Eliyahu

"rockdale" <ro************@gmail.com> wrote in message
news:11**********************@y41g2000cwy.googlegr oups.com...
Hi, All

I have a textbox for user to input SSN, I havea javascript to format
what he input to SSN format, I also have a onChange postback function
to retrieve other info based on the SSN.
<asp:TextBox id="txtSSN" runat="server" AutoPostBack="true"
onKeyDown="javascript:myJavaFunction"></asp:TextBox>

in code behind
protected void SSN_OnTextChanged(object sender, System.EventArgs e)
{
//do database query
}

The OnTextChanged event triggered correct if I do not have the
OnKeyDown Javascript. But if I put the onKeyDown javascript. then the
OnTextChanged event won't get triggered.

Can I put both JavaScript and postback function on one control? If so,
what I did wrong or is there another work around?

Thanks a lot
-Rockdale

Jun 28 '06 #2
I am sorry. In my first post, onKeydown should be onKeyDown="return
myJavaFunction()".

If I remove protected void SSN_OnTextChanged() post back function, My
jjavascript function works fine. but not both.

Again, thanks
-Rockdale

Eliyahu Goldin wrote:
Try

onKeyDown="return myJavaFunction()"

and make myJavaFunction return true.

Eliyahu

"rockdale" <ro************@gmail.com> wrote in message
news:11**********************@y41g2000cwy.googlegr oups.com...
Hi, All

I have a textbox for user to input SSN, I havea javascript to format
what he input to SSN format, I also have a onChange postback function
to retrieve other info based on the SSN.
<asp:TextBox id="txtSSN" runat="server" AutoPostBack="true"
onKeyDown="javascript:myJavaFunction"></asp:TextBox>

in code behind
protected void SSN_OnTextChanged(object sender, System.EventArgs e)
{
//do database query
}

The OnTextChanged event triggered correct if I do not have the
OnKeyDown Javascript. But if I put the onKeyDown javascript. then the
OnTextChanged event won't get triggered.

Can I put both JavaScript and postback function on one control? If so,
what I did wrong or is there another work around?

Thanks a lot
-Rockdale


Jun 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
1
by: Jorge Ponte | last post by:
hi I have a Web User Control (ascx) - lets call it "My_WUC" - in a Web form. In that WUC I want have a textbox and a button. I want to click on the button and open a popup (I use javascript for...
7
by: joey.powell | last post by:
I have a home page with username and password textboxes and a login button for purposes of users being able to log in (forms authentication) directly on the site home page. I also have a dedicated...
4
by: Shawn Repphan | last post by:
I apoligize if this is out of scope with this group. I have a textbox that displays a current record number(xx of xxx). The user has the ability to enter their own number into this box and perform...
2
by: Phil | last post by:
Hi, There is a label and a textbox. There are two buttons: one HTML (buttonA), the other ASP.NET (ButtonB). Clicking on buttonA starts a javascript function, starting on ButtonB triggers...
2
by: wildman | last post by:
RE: Gridview textbox has data check without postback.. javascript? I have a gridview with a textbox. I can set the textbox to autopostback and check for a value in a prerender event to decide if...
6
by: john | last post by:
I have the following textbox setup with Text & ToolTip Bindings as follows; I'm using Visual Studio 2008 VB: <asp:TextBox ID="txtDay1" runat="server" Text='<%# Eval("Day1") %>'...
4
by: Peter | last post by:
ASP.NET I have an application which use ASP.NET Autocomplete extender which works great. But I have a question how to update all the fields on the screen using Ajax. Users starts typing in a...
2
Frinavale
by: Frinavale | last post by:
JavaScript in ASP.NET Using JavaScript in ASP.NET pages can make your application seem to work faster and prevent unnecessary calls to the server. JavaScript can be used to perform client-side...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.