This is a migrated thread and some comments may be shown as answers.

SelectedIndexChanged Does Not Fire

6 Answers 209 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Lynn
Top achievements
Rank 2
Lynn asked on 18 Oct 2009, 05:33 PM
I am encountering a similar problem to the problem description in forum entry
http://www.telerik.com/community/forums/aspnet-ajax/listbox/selectedindexchanged-does-not-fire.aspx .  This problem (the event not firing) has been tested and is "hard and repeatable".  It occurs when selecting an item that does not show in the first displayed group of items.  For example, I have a listbox with 20 items, but it is only tall enough to show 9 items at a time.  Clicking on any of the nine items displayed when the page first loads correctly causes the SelectedIndexChanged event to fire.  However, clicking on any item in the list that is below the first 9 will not produce the event and the selected item on screen will return to the originally selected item.

I have seen the code suggested in the above specified forum item which is to be "put on your page", but have no idea where/how to include the code on a web page so that it will run correctly.  I have included this code as javascript on the page, but then receive the following error "Microsoft JScript runtime error: 'Sys' is undefined" and have to ignore the error for the page to continue/complete loading.

Once the page loads, the listbox still behaves incorrectly per the problem description at the beginning of this entry.  The error "Microsoft JScript runtime error: 'Sys' is undefined" only occurs at page load - which indicates that the javascript does run at page load.  It will also occur if I click on an item displayed in the first 9 items.  It does NOT occur when I click on item 10 or higher.

This is occurring in "RadControls for ASP.NET AJAX Q2 2009"; Telerik.Web.UI.dll, version 2009.2.701.35; IE 8.0.6001.18828.

If I run the web page in IE8 in "compatibility mode", the listbox functions correctly.  This is not a satisfactory resolution.

Thanks in advance for any assistance!

Lynn

6 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 19 Oct 2009, 09:11 AM
Hello Lynn,

This is bug that we have already fixed. I suggest that you upgrade to the latest version of your controls. If you are not able to upgrade, please use the fix provided in the aforementioned forum post. You need to paste the code right after your script manager declaration.

<asp:ScriptManager runat="server" ID="ScriptManager1">
  </asp:ScriptManager>
 
  <script type="text/javascript">
      function onSelectedIndexChanged(sender, eventArgs) {
          sender._activateItem(eventArgs.get_item());
      }
 
      Sys.Application.add_init(function() {
          Telerik.Web.UI.RadListBox.prototype._onGroupMouseDown = function() { };
      });
   
  </script>


Regards,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Lynn
Top achievements
Rank 2
answered on 19 Oct 2009, 01:05 PM
Genady,

Thank you for the reply.  Yes, once I put the script in the correct place, the original problem (event not firing) was corrected.  I will download the latest version and use that.  I wasn't aware that it would resolve this particular problem.

Thanks!
0
Drew
Top achievements
Rank 2
answered on 27 Oct 2009, 03:27 PM
We ran into this issue after we already made a page live.  We are now scrambling to get a fix out.

What version of the controls contains the fix for this?  We don't want to put the latest development version out there if it has not been fully tested.  
0
Lynn
Top achievements
Rank 2
answered on 27 Oct 2009, 03:44 PM
Drew,

I have downloaded the latest version available but have not yet tested it myself.  I have a little work to do before I can do that.  The workaround suggested by Genady did work perfectly once I put the script in the correct place and we are still using it in development.

I know you want a permanent fix (and I agree), but this is quick and did solve my issue.  If you have a production page with this problem, Genady's simple script should resolve it.  See the attached graphic for a more complete view of the implementation of this workaround.

I'll butt out now and let Telerik confirm the "production version" of the controls that eliminates this problem.

Lynn

0
Drew
Top achievements
Rank 2
answered on 27 Oct 2009, 03:51 PM
The code provided fixed the problem.   Thanks for the response Lynn.

 I am still wondering if there is a production build that fixes the issue.
0
Accepted
Genady Sergeev
Telerik team
answered on 29 Oct 2009, 06:07 PM
Hello Drew,

The official fix is going to be available forth from the Q3 release which is scheduled for the beginning of the next week.

Greetings,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ListBox
Asked by
Lynn
Top achievements
Rank 2
Answers by
Genady Sergeev
Telerik team
Lynn
Top achievements
Rank 2
Drew
Top achievements
Rank 2
Share this question
or