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 »

OnChange event is not executed


Posted Date: 22 Oct 2009      Posted By: Alwyn      Member Level: Gold     Points: 1   Responses: 4



I have a HTML Select control, in the OnChange() event i'm calling a javascript function. When i select a value in the dropdown, first time it's not calling te javascript function, when i select the next value it's calling the function. i don't know why it's acting like this?
Any help would be appreciated.

Thanks & Regards,
Alwyn.
Jesus saves! The rest of us better make backups.





Responses

Author: Anuraj    22 Oct 2009Member Level: DiamondRating: 1 out of 5     Points: 1

Check this link

http://msdn.microsoft.com/en-us/library/ms536912%28VS.85%29.aspx

Thanks
Anuraj
THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS.
BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT.
dotnetthoghts



Author: Alwyn    22 Oct 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

I rectified the issue.

Problem was, my below control didn't fire for the first time.

<select id = "abc" onchange = "showAlphabets()" runat="server">

i added javascript like the below and it's working.

<select id = "abc" onchange = "Javascript:showAlphabets()" runat="server">


whenever a control has a same event in both server and client side, we need to mention javascript: before the function.

Thanks & Regards,
Alwyn.
Jesus saves! The rest of us better make backups.



Author: Chandra Shekar.Y    22 Oct 2009Member Level: GoldRating: 1 out of 5     Points: 1

Hi

Do you want default value to be selected in the drop down based on the selection, do you want the event to be fired?

if that is the case you need to set the selectedindex of the default value you set. This will fire the onchange event for the drop down.



Author: Alwyn    22 Oct 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

u r wrong chandra, please read my question once and my Reply on how i rectified that issue.

Thanks & Regards,
Alwyn.
Jesus saves! The rest of us better make backups.



Post Reply
You must Sign In to post a response.
Next : Validate date using javascript
Previous : Mouseover event code to pause image floating
Return to Discussion Forum
Post New Message
Category: JavaScript

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use