473,659 Members | 2,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript + Asp.net = not firing event

I have a simple drop down list and I want the indexchange event to
fire when the user changes the index to 0. So, in other words, I want
the form to sumbit only when I change to index = 0, otherwise, it dont
submit.

At first, I turned on autopostback, and asp.net adds the
onchange="__doP ostBack('id', '') to my drop down list on the client
side. This basically just submits everytime I changes the index. With
this code, it event always when I submit.

Then I turned off autopostback, and added attributes to my drop down
list. The attribute added is onchange, value is
"if(this.select edIndex==0){__d oPostBack('id', '')}". So, when the page
is rendered, I get onchange="if(th is.selectedInde x==0){__doPostB ack('id','')}"
in my drop down list. This looks right. So I go about changing the
index. When I change the index to 0, the form submits, BUT the event
does not fire.

I then changed the attribute to just "__doPostBack(' id','')" and with
this attribute, the form submits and the event is fired.

Now, the question is, why doesn't the first attribute work?
Nov 17 '05 #1
0 1123

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

Similar topics

4
5877
by: joebob | last post by:
The following script if run in Internet Explorer should display a thumbview of a webpage that you point it to. To test it, replace test.htm with a valid html file. The problem I'm having is that I can't get onclick to fire on the rendered Thumbview object. What's strange is that onmouseover fires. Can anyone see a way? <html><head><title>test</title></head> <body onload="Init()">
14
5453
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 that works well as an html page. It brings up a modal popup window that I have been trying to work out for days now and this was the closest I have been able to come. I added a little asp.net code and an asp.net button and cannot get it to
1
1508
by: panitw | last post by:
I have a UserControl hosted in Internet Explorer. I create a worke thread to do some task and want to fire an event when the worker threa finish working. The event works fine, javascript can caugth it, when it fired from th main thread or from the code in external event handler such as Butto clicked event. But when fired from the worker thread, th "System.Reflection.TargetExceltion : Object does not match target type
2
1459
by: bill yeager | last post by:
I tried placing the following logic in my page_load event to handle the client-side jhavascript needed to add the first 2 textboxes to the total: <code> txtMileageBeginning.Attributes.Add("onChange", "ChkMileage (document.getElementById('" & txtMileageBeginning.ClientID & "'), document.getElementById('" & txtEnding.ClientID & "'), document.getElementById('" & txtTotal.ClientID & "');")
6
4496
by: Jim | last post by:
Group, How would I go about firing a JavaScript method from a C# method in the aspx code behind file? It seems as though this could not be done since JavaScript is executed from within the Web browser and C# is executed on the server. Thanks for your consideration, Jim
0
3711
by: Chris Fink | last post by:
My goal is to have an ASP.NET checkbox server tag with it's autopostback set to true, that when clicked will run the checkbox's CheckedChanged event. However, I would like to try to add a javascript confirm popup to this checkbox server control to prevent this event from firing if the cancel button is checked in the js confirm window. In the example below, I am able to accomplish this using the input type=checkbox but without the...
7
3667
by: CharlesA | last post by:
Hi folks, first off, I'm using .Net framework 1.1 with ASP.net and C# I'm trying to do something very simple...but I can't figure it out I have an <asp:button runat="server"> in the test version of my app that is essentially a backdoor for changing the class of user inside the application on the fly....it has a textbox next to it you can type 1, 2, 3, 4 etc.. in the text box and when you click the button
4
2115
by: sjkothenbeutel | last post by:
I've been reading through quite a bit regarding this topic but am finding myself confused. Here is the scenario: I have a javascript class defined with methods whereas each has references to "this." As everyone is aware of, when you attach and event from an element to a class method and the class method references "this", the scope of "this" refers not to the class but rather to the element firing the event.
2
1701
by: =?Utf-8?B?QVZM?= | last post by:
i've a webpart which has datarepeater control.. the datarepeater control has some rows along with the delete button.. I want to shown a confirmation pop up before performing delete action..using javascript.. Ive binded the javascript to the button in the itemcreated event ...but it's not firing properly.. After I clcik on the 'Ok' button in pop up.. the itemcommand event of the repeater isnt firing....
0
8341
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8751
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8539
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4342
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.