Click here to Skip to main content
15,911,848 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Requirement in Drop down list Pin
Hari_10107-Aug-07 20:12
Hari_10107-Aug-07 20:12 
AnswerRe: Requirement in Drop down list Pin
Michael Sync7-Aug-07 20:11
Michael Sync7-Aug-07 20:11 
GeneralRe: Requirement in Drop down list Pin
Hari_10107-Aug-07 20:16
Hari_10107-Aug-07 20:16 
GeneralRe: Requirement in Drop down list Pin
Christian Graus7-Aug-07 20:33
protectorChristian Graus7-Aug-07 20:33 
GeneralRe: Requirement in Drop down list Pin
Michael Sync7-Aug-07 22:15
Michael Sync7-Aug-07 22:15 
GeneralRe: Requirement in Drop down list Pin
Hari_10107-Aug-07 22:21
Hari_10107-Aug-07 22:21 
GeneralRe: Requirement in Drop down list Pin
Hari_10108-Aug-07 1:52
Hari_10108-Aug-07 1:52 
GeneralRe: Requirement in Drop down list Pin
Michael Sync8-Aug-07 7:42
Michael Sync8-Aug-07 7:42 
Hello Hariharan,

I just arrive at home and I remember your question that I don't have enough time to figure out the solution.. So, I opened my page and I'm trying to reproduce this issue. Now, I have tested with Internet Explorer 7, Firefox 2.0.0.6, Opera 9.2 and Safari 3.0.3. It is working fine in all those browsers except internet explorer 6. I don't have this one in my laptop. I tried to install IE6 standalone version that can run with IE7 on same machine but that installer doesn't work on Windows Vista. Frown | :(

Anyway, I'm gonna give you some codes that I think it should work on IE6.

<script language="javascript" type="text/javascript"><br />
      var pressedKeyString = "";<br />
      var delay = 1000;<br />
      var timeID = null;<br />
      function move(id){<br />
        <br />
        var selectList = document.getElementById(id);<br />
        var arr = new Array();<br />
        <br />
        var idx = 0;<br />
        <br />
        for(var i = 0; i < selectList.options.length-1; i++){           <br />
           if(selectList.options[i].value.length >= pressedKeyString.length){<br />
             if(pressedKeyString.toLowerCase() == selectList.options[i].value.substring(0,pressedKeyString.length).toLowerCase()){<br />
                 selectList.options[i].select = true;                                  <br />
                 i=selectList.options.length;                                  <br />
             }<br />
           }                      <br />
        }<br />
        <br />
        //pressedKeyString = "";<br />
      }<br />
      <br />
      function foo(e,id){<br />
        if(timeID != null)clearTimeout(timeID);<br />
        timeID = setTimeout("move('" + id + "');",delay);<br />
        <br />
        var key;<br />
        if(window.event) // IE<br />
        {<br />
           key = e.keyCode<br />
        }<br />
        else if(e.which) // Netscape/Firefox/Opera<br />
        {<br />
           key = e.which<br />
        }        <br />
        <br />
        var pressKey = String.fromCharCode(key);<br />
        pressedKeyString += pressKey;           <br />
        <br />
      }<br />
      <br />
    </script>


 protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
        DropDownList1.Attributes.Add("onkeypress", "foo(event,'" + DropDownList1.ClientID + "');");<br />
<br />
        List<string> list = new List<string>();<br />
        list.Add("Alien");<br />
        list.Add("Emos");<br />
        list.Add("Poker");<br />
        list.Add("Peter");<br />
        list.Add("Michael Sync");<br />
        list.Add("Petro");<br />
        list.Add("Pet");<br />
        list.Add("Elizabeth");<br />
<br />
        DropDownList1.DataSource = list;<br />
        DropDownList1.DataBind();<br />
    }


The main idea of this code is that we will enable the timer to check whether the user is still typing or not. The timer will get clear as long as the user keep on typing. If the user stop then the timer will count 1000 minisecound and will invoke the Move function. In that function, we will do some string comparison to find whether there is any item which is started with the string that the user type or not. If we found the matched string then we will make this item as a selected item..

this is the idea. I'm not so sure whether it gonna work without error or not since I haven't tested yet and I don't have IE6 installed in my machine. For the time being, you can do some modifications to this code if you interest the idea. I will test my script for you tomorrow because the machine from my office has IE6 installed.

Anyway, what I like to suggest you is that if the particular thing works on main browsers except IE6, you should not spend so much time for finding the solution ...


Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)

If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. Smile | :)

GeneralRe: Requirement in Drop down list Pin
Hari_10108-Aug-07 20:49
Hari_10108-Aug-07 20:49 
GeneralRe: Requirement in Drop down list Pin
Hari_10108-Aug-07 23:50
Hari_10108-Aug-07 23:50 
GeneralRe: Requirement in Drop down list Pin
Michael Sync9-Aug-07 15:28
Michael Sync9-Aug-07 15:28 
GeneralRe: Requirement in Drop down list Pin
Hari_10109-Aug-07 18:38
Hari_10109-Aug-07 18:38 
GeneralRe: Requirement in Drop down list Pin
Michael Sync9-Aug-07 20:01
Michael Sync9-Aug-07 20:01 
GeneralRe: Requirement in Drop down list Pin
Hari_10109-Aug-07 20:21
Hari_10109-Aug-07 20:21 
GeneralYou forget to uncomment Pin
Michael Sync10-Aug-07 8:30
Michael Sync10-Aug-07 8:30 
GeneralRe: You forget to uncomment Pin
Hari_101012-Aug-07 18:12
Hari_101012-Aug-07 18:12 
GeneralRe: You forget to uncomment Pin
Hari_101012-Aug-07 19:06
Hari_101012-Aug-07 19:06 
GeneralRe: You forget to uncomment Pin
Michael Sync12-Aug-07 19:45
Michael Sync12-Aug-07 19:45 
GeneralRe: You forget to uncomment Pin
Hari_101012-Aug-07 19:58
Hari_101012-Aug-07 19:58 
QuestionProblem with Header Background image? Pin
chand107-Aug-07 19:50
chand107-Aug-07 19:50 
QuestionDisplay DB records In Flash Pin
kirthikirthi7-Aug-07 19:22
kirthikirthi7-Aug-07 19:22 
AnswerRe: Display DB records In Flash Pin
Christian Graus7-Aug-07 19:29
protectorChristian Graus7-Aug-07 19:29 
GeneralRe: Display DB records In Flash Pin
kirthikirthi7-Aug-07 20:03
kirthikirthi7-Aug-07 20:03 
GeneralRe: Display DB records In Flash Pin
Christian Graus7-Aug-07 20:08
protectorChristian Graus7-Aug-07 20:08 
Questionsession_end Pin
Sonia Gupta7-Aug-07 19:07
Sonia Gupta7-Aug-07 19:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.