Why SelectedIndexChanged event in DropDownList boxes not firing?

Hello, friends,

We had a VS.net 2003 web app in c#, which worked fine.

Lately we upgraded it to VS.net 2008. Everything works fine except that ALL the SelectedIndexChanged events in DropDownList boxes don't fire any more.

Rather, it looks like it tries to submit the form.

After more researches, I found:

In the source code, there was a JavaScript function isValidInput() for form onsubmit event, i.e., onsubmit="return isValidInput()"

In VS2003, this function was not called when SelectedIndexChanged event in DropDownList boxes was fired.

In VS2008, this function was called when SelectedIndexChanged event in DropDownList boxes was fired.

In either case, DropDownList had property AutoPostBack="true".

Before, when a user selected a different list index from DDL, it won't check validation. So, it worked. (It validated inputs only when a user clicked on Send button to submit this form).

Now, when a user selected a different list index from DDL, it WILL check validation. User can go nowhere since he/she need more data based on the selected item in DDL. So, now it does work.

If I get rid of isValidInput() function, events are fired as normal.

How to get around this? Any ideas? (This would be a nightmare if we had to rewrite it in VS.net 2008 since it is a pretty big app)

Thanks a lot for your help.

(This question was modifed due to new info we found. Thanks)

0
vbird2k
5/4/2009 9:36:45 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

3 Replies
2268 Views

Similar Articles

[PageSpeed] 50

Are you rebinding controls on Page.IsPostBack?

It is hard to say without seeing the code, but a gotcha I have seen before is that all controls (including the DropDownList) are rebound on each page cycle which stops the event firing.

0
moopa
5/4/2009 10:01:22 PM

moopa:

Are you rebinding controls on Page.IsPostBack?

It is hard to say without seeing the code, but a gotcha I have seen before is that all controls (including the DropDownList) are rebound on each page cycle which stops the event firing.

No. I could not find Page.IsPostBack in source code.

But in form, it has method="post" attribute. 

0
vbird2k
5/4/2009 10:06:38 PM

moopa:

Are you rebinding controls on Page.IsPostBack?

It is hard to say without seeing the code, but a gotcha I have seen before is that all controls (including the DropDownList) are rebound on each page cycle which stops the event firing.

Hello, Moopa and everyone,

I think I should modify the question after more researches:

In the source code, there was a JavaScript function isValidInput() for form onsubmit event, i.e., onsubmit="return isValidInput()"

In VS2003, this function was not called when SelectedIndexChanged event in DropDownList boxes was fired.

In VS2008, this function was called when SelectedIndexChanged event in DropDownList boxes was fired.

In either case, DropDownList had property AutoPostBack="true".

Before, when a user selected a different list index from DDL, it won't check validation. It validated inputs only when a user clicked on Send button to submit this form. So, it worked.

Now, when a user selected a different list index from DDL, it WILL check validation. User can go nowhere since he/she need more input based the selected item in DDL. So, now it does work.

How to get around this?

Thanks a lot.

0
vbird2k
5/4/2009 10:33:53 PM
Reply:

Similar Artilces:

How to fire events in other web form from other web form ?
Suppose that I have A and B web form. I want to trigger B web form's Page_Load event from A web form. How can I do that ? Thanks in advanced WilbertWilbert Bujn Create a public method in B that call the load method : public void Load(object sender, System.EventArgs e) { Page_Load(sender, e) ; } In the page_load of A, instanciate a B object and then call the function B myB = new B() ; myB.Load() ; Quicky Thank you quicky, it works fine. WilbertWilbert Bujn...

DropDownList's SelectedIndexChanged event not firing when form is 'AutoFill'ed
Hi, I have a DropDownList called ddlCountry in ASP.Net page. I have another DropDown called ddlState. Whenever user changes the selection in ddlCountry I populate state drop down with the states in that country. Problem is when I fill the form using AutoFill feature of 'Windows Live Toolbar' the SelectedIndexChanged event for ddlCountry is not fired and the state drop down is not filled. Any help will be appreciated.- SujitDont forget to click "Mark as Answer" on the post that helped you.This credits that member, earns you a point and marks your thread as Resolved so we w...

Unexpected event firing in combo box selectedIndexChanged event
Hi, In My screen, I have 3 controls 1 - A Combo box to select Names 2 - A text box to display and change address 3 - A save button I have put all these 3 controls in an update panel, to avoid page refresh when the user selects a name, as well as after the save. Functionality: 1. The user will select a name from the comb box, selected index event will be fired to retrieve existing address and display it in the text box. 2. User can edit the address. 3. User will click the Save button to save the changed/edited address. Issue: When the user clicks the save button to sa...

Load Text box of one web form with selected list item of list box of another web form
one help please Problem is i have two web forms  1.  ForiegnkeyTest.aspx  2. foroginkeytable.aspx   step 1 1 ForiegnkeyTest.aspx one web form <head runat="server"><script language="javascript" type="text/javascript">   function popWin()   {         var confirmWin = null;      confirmWin = window.open('foroginkeytable.aspx','anycontent',   'width=455,height=435,status');   }  </script> &...

SelectedIndexChanged event of dropDownList not firing
I have a dropdownlist inside a modal window which is inside an update panel which is then in turn nested inside another update panel (in order to set postback triggers). I have the autoPostBack set to true and when the value changes the page does post back (because the Page_Load) event fires but the selectedIndexChanged event does not fire. What gives?   Have you tried setting a break point at the SelectedIndexChaged event of the DDL to check if HITS there? Can you also post your codes here sothat we can check it out? Both ASPX and Code behind of DDLRegards,Vinz"Code, Beer and M...

DropDownList SelectedIndexChanged event not firing
I have a dropdown list that has many items in it - so in order to reduce viewstate size I have shut off viewstate for that control. But since doing so - the selectedindexchanged event is not firing (I guess because without view state the control does not know if there was a change in the selected value so it can't determine if it should fire the changed event. Is there any way I can detect this change on the client and fire the selectedindexchanged event on the server? thanksMichael   May be you can try to bind the dropdown list in the Page_Init event handler.. Then you do not...

selectedIndexChanged event does not fire of dropdownlist...
Hi All, I have two dropdownlist in my page, on selectedindexchanged event of ddl1 i want to fill ddl2 with the selected value of ddl1. i m using server side code in code behind file and i m using vb.net. how can i do that.   Thanks -nelly        Hi, try the below one...  Dim x As New ListItem  x.Text = ddl_1.SelectedItem.Text  x.Value = ddl_1.SelectedItem.Value  If ((ddl_2.Items.FindByText(x.Text) Is Nothing) And (ddl_2.Items.FindByValue(x.Value) Is Nothing)) Then  ddl_2.Items.Add(x)  End IfVasanthakumarSoft...

Dropdownlist event not firing selectedindexchanged
Hi,I've created a dropdownlist which links to SQL Server data, and that's fine.I've added a MANUAL new entry called "None" to the Dropdownlist (text is "None", value is "None"), but the SelectedIndexChanged event doesn't fire up when the user selects this. But it does fire up with the other selections. I've tried changing "Selected" in the ListItem Collection Editor, and also AutoPostback, but it just doesn't seem to work. Any suggestions? ThanksTushar  Instead of adding the 'None' value manually, you can add tha...

Dropdownlist does not fire Event SelectedIndexChanged
1. how to fire SelectedIndexChanged Event, i looked through some samples, they use a button to process, how can I know the selection changed and don't need the user to hit a button. 2. May key in sth in DropDownList control, if the content the user keyed in match with one item, then scroll to that position, otherwise, just fire the event TextChanged. Thanks 1. set the AutoPostBacd attribute of the ddl to true 2. what you need is a combobox,there is not intrinsic control, you could  use a 3rd party control     free       &nb...

No events fire on web form
My web form suddenly quit working in that none of the server controls events fire when you click on them.  Only page initialization and the page_load routine execute.  I also can't debug the app because the breakpoints never get hit when they are set on each event. Any ideas?  I hadn't changed any code when it quit working so this is really strange.  Other web forms in the project still work fine. Thanks for any advice!   Try to double check the Button Click handler.. see whether if this portion code is missing or not..I have encountered the same problem before,...

Troubleshoot Web Service; Ajax AutoComplete events do not appear to not fire; Ajax web service appears to not work. .NET
Folks, I had the situation that Ajax AutoComplete events in the web service did not fire after I copied a project out of a folder, renamed it and moved it to a server. The fix was hard to find but easy to solve. I had some web service modules in an ASMX file that provided AutoComplete entries -- i.e., after the user keys in 2 or 3 characters, the list of possible entries with those leading characters is displayed for the user to select. To solve the problem, look at the web service's directive, not the code-behind or the ASMX designer.  Do a right-mouse-click...

Dropdownlist selectedindexchanged event fires after validation
Hello,Here is the scenario; There is a dropdownlist on the page and I fill it dynamically. Also after binding the dropdownlist ,I create an item called "Select" and set its value to 0 ..  ddlCars.Items.Insert(0, new ListItem("Select", "0")); Also on the page there is a gridview and it has linkbuttons on it.Linkbuttons are created dynamically on templatefield.Linkbutton's CausesValidation is set to "false".There is also a  RequiredFieldValidator ;<asp:RequiredFieldValidator ID="reqddlCars" runat="server" Control...

How to fire DropDownList.SelectedIndexChanged event programatically?
Hello!I have a DropDownList named ddl which has its AutoPostback property to true and its SelectedIndexChanged event is handled via ddl_SelectedIndexChanged(object sender, EventArgs e) event handler. When user changes item in ddl on a form, PostBack occurs, and everything works fine - SelectedIndexChanged is fired and I can process it in ddl_SelectedIndexChanged method mentioned above. However, if some other PostBack occurs (suppose some button is pressed), and I change ddl.SelectedValue programatically in button_OnClick event handler, SelectedIndexChanged event of ddl is not fired. I guess ...

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

Web resources about - Why SelectedIndexChanged event in DropDownList boxes not firing? - asp.net.web-forms

Does “display:none” render the control ineffective?
I am using a CMS for my site and im trying to alter the Skin of one module in the CMS. I do not have the source code of the module. Only the ...

Resources last updated: 12/18/2015 9:41:03 PM