Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 18th, 2008, 09:24 PM
Registered User
 
Join Date: Jan 2005
Location: St Paul, MN, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dropdown list Manipulation - JScript triggering..

I am creating a ASP.net / VB.net application.

On the ASP.net they will be either typing in the information or using the scroll bar.

When they use the scroll bar it fires the "cboCode_SelectedIndexChanged" = Dropdownlist, but when they type it in and then tab out, it does not fire this code. Any ideas on how to fix this via JScript and samples?

//DropDown List in VB.net
ddlCode.Attributes.Add("onkeypress", "return KeySortDropDownList_onkeypress(this,false)")


// JScript File


function KeySortDropDownList_onkeypress(dropdownlist,caseSe nsitive) {
  // check the keypressBuffer attribute is defined on the dropdownlist
  var undefined;
  if (dropdownlist.keypressBuffer == undefined) {
    dropdownlist.keypressBuffer = '';
  }
  // get the key that was pressed
  var key = String.fromCharCode(window.event.keyCode);
  dropdownlist.keypressBuffer += key;
  if (!caseSensitive) {
    // convert buffer to lowercase
    dropdownlist.keypressBuffer = dropdownlist.keypressBuffer.toLowerCase();
  }
  // find if it is the start of any of the options
  var optionsLength = dropdownlist.options.length;
  for (var n=0; n < optionsLength; n++) {
    var optionText = dropdownlist.options[n].text;
    if (!caseSensitive) {
      optionText = optionText.toLowerCase();
    }
    if (optionText.indexOf(dropdownlist.keypressBuffer,0) == 0) {
      dropdownlist.selectedIndex = n;
      return false; // cancel the default behavior since
                    // we have selected our own value
    }
  }
  // reset initial key to be inline with default behavior
  dropdownlist.keypressBuffer = key;
  return true; // give default behavior
}



So it is not firing the (cboCode_SelectedIndexChanged).Accept and Award Points Accept as Solution


 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
List box manipulation ayem Visual Studio 2008 0 August 15th, 2008 01:32 AM
Dropdown list maha .NET Framework 2.0 7 April 28th, 2007 12:32 AM
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM
HELP WITH DROPDOWN LIST enavas Excel VBA 1 April 6th, 2004 02:08 PM



All times are GMT -4. The time now is 07:11 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.