Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 15, 2012 06:42 PM by glocklt4
Jun 22, 2007 12:54 AM|LINK
I was wondering if anyone else has noticed this. When a DropDownList control is extended with ListSearchExtender, and the DropDownList has the AutoPostBack property set to true, the page loads twice. If you step through the debugger you will see OnInit,
OnPrerender, Page_Load, etc. being called twice.
Does anyone have a workaround to prevent this?
List Search Extender listseachextender postback twice page load
Jun 22, 2007 04:56 AM|LINK
I'll try to reproduce this to see if I can work out what is going on. Do you have a simple page with just a DropDownList and the extender on it? (No UpdatePanels etc).
Jun 22, 2007 10:21 PM|LINK
This is intereesting. ListSearch only causes double postback when a breakpoint is set. I put together the following code. If you set a breakpoint anywhere in the code-behind, clicking the ListSearch-enabled DropDownList will post back twice. But if you
do not have a breakpoint, it posts back once. It still is behavior that doesn't occur without the ListSearch, but at least it isn't REALLY posting twice. Any idea why this is occurring?
DropDownList without ListSearch. Click on
DropDownList with ListSearch. Click on a
Label2.Text = dropDownListPostCount.ToString();
dropDownListPostCount = -1;
Jun 22, 2007 10:52 PM|LINK
More importantly is the problem of ListSearchExtender not working with CascadingDropDownExtender. This one is easy to see. Just attach both extenders to a DropDownList (like the one in the sample web site) and when you close the form or click on another
Jun 28, 2007 06:52 PM|LINK
I'm guessing that you are seeing multiple postbacks because the SELECT is losing focus several times as the debugger takes focus away, and gives it back -- the extender fires the OnChange when the SELECT loses focus.
With regards to the error with the CascadingDropDownExtender, I have not managed to reproduce this -- I added ListSearchExtenders to each of the lists on the CascadingDropDown example in the toolkit and had no issues -- could you perhaps post a small example
where you are getting an error?
Jul 13, 2007 06:56 PM|LINK
Hi, Damian. Sorry for the delay in getting back to you.
If you download the "How do I?" demo for CascadingDropDown found at
http://www.asp.net/learn/videos/view.aspx?tabid=63&id=77 and add ListSearch to it, you will see the problem. (You will have to update the AjaxToolkit.dll, since that how-to was written prior to ListSearchExtender.) If you add the following lines to Default.aspx
between the opening form tag and the opening table tag that contains the 3 dropdownlists, you will see what I mean:
It will run fine, but when you close the page, or try to go to a different URL, you will get the following message:
Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method.
I would really like to use these two extenders together. Could you look into this?
Jul 19, 2007 07:35 PM|LINK
I was able to get ListSearch and CascadingDropDown to work together by removing this line:
from the dispose function in ListSearchBehavior.js. I tried replacing it with this code:
but it still failed.
What are the consequences of removing this call? I assume it would be a memory leak, but is it a leak on the user's machine that goes away when they navigate to a new page, or when they close the browser? Does it increase with each postback? Does it affect
the server? Do the $removeHandler() functions in CascadingDropDownBehavior.js take care of this on behalf of ListSearchExtender (which I assume has something to do with the failure)? etc....
ListSearch CascadingDropDown removeHandler clearHandler InvalidOperationException addHandler
Jul 25, 2007 04:45 PM|LINK
Jul 26, 2007 07:31 AM|LINK
I'll be looking into this in the next day or so and will do my best to get a fix into the next toolkit release.
Jul 26, 2007 02:12 PM|LINK