C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » JavaScript »

Enter Problem in Autocomplete Textbox


Posted Date: 12 Nov 2008      Posted By: Jagwinder Walia      Member Level: Gold     Points: 1   Responses: 6



Hi all
i have build a autocomplete textbox control that works on keyup event in javascript. everytime a keyup is called , a request is send back to server and the suggestion are displayed in div below the textbox.
when enter is pressed,selected value comes in textbox. Now the problem is when i pressed enter button event is called. and the list disapears.

To solve this i set it to on keydown event. but the keydown is called twice, i dont why. even when keydown is pressed i dint get the typed word.

Could anyone tell the solution of this one.

Thanks in advance.
Jagwinder Singh





Responses

Author: npradeep    12 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

Hi,

try to use keyup and also handle the enter button, that return false for the keycode 13..so that it wont be fired to server.

regards,
pradeep.

Regards,
Pradeep.

Please remember to Rate “Excellent or Good or Poor”



Author: Jagwinder Walia    12 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

thanks for quick reply pradeep.
i did the same thing u said. i have added keyup event but the problem not solved. button event still fires on enter key.

i think button event fires on keydown event. is that??

could you tell me how i can get typed word on keydown event??

Thanks
jagwinder singh



Author: Jagwinder Walia    12 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

hello pradeep
i solved the problem by diabled enter key on keydown.
it works fine
thanks



Author: npradeep    12 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

Hi Jagwinder,

i am sorry i didnt see your mssgs,

great that u have fixed it...

happy coding

regards,
pradeep

Regards,
Pradeep.

Please remember to Rate “Excellent or Good or Poor”



Author: Jagwinder Walia    13 Nov 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 3

Hello pradeep
i found new problem in this. i have filled a div with number of dives inside. i set the it style
style="height=100px;overflow:auto"
but the problem when scroll the main div..its get hidden.
thanks in advance.
Jagwinder Walia.



Author: Pradeep Iyer    27 Nov 2008Member Level: DiamondRating: Revenue Score: 0     Points: 0

private void Page_Load(object sender, System.EventArgs e)
{
if(Session["UserId"].ToString()== null)
{
Response.Redirect("login.html");
}
else
{

if (Page.IsPostBack == false)
{

if (Session["AuditLog"].ToString () == "Yes")
{
string strLoggedUserID ="";
int intBankID;
string strSQL;
intBankID = Convert.ToInt32(Session["BankCode"].ToString());
strLoggedUserID = Session["UserId"].ToString();

String HostName;
HostName=Dns.GetHostName();
IPHostEntry IpEntry=Dns.GetHostByName(HostName);
IPAddress[] addr=IpEntry.AddressList;
string sIPADDR = "";
for (int i = 0; i < addr.Length; i++)
{
sIPADDR = sIPADDR + addr[i].ToString();
}

AuditTrail AObj = new AuditTrail(strLoggedUserID,"LogIn",intBankID,sIPADDR);
AObj.SaveLoginDetail();
Session["AuditLog"] = "No";

strSQL = "UPDATE USERS SET LASTIPADDRESS = '" + sIPADDR + "' WHERE USERID = '" + strLoggedUserID + "'";
IDbCommand cmdUpdateQuery = DAL.CreateCommand(strSQL);
cmdUpdateQuery.CommandType = CommandType.Text;
DAL.ExecuteNonQuery(cmdUpdateQuery);
}
}
//End for PCI Changes
}
}

Regards,
Pradeep Iyer



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : how to generate java code for ip change
Previous : How to check whether an url is opened already
Return to Discussion Forum
Post New Message
Category: JavaScript

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use