HtmlSelect control is not helping and client side coding became a real headache

Discussion in 'ASP .Net' started by Suhail A, Salman, Aug 13, 2003.

  1. Dear All,

    I placed a HtmlSelect control on a web page and set "Run at Server", the
    objective of this list box is that the client adds all his accounts to this
    text box, and because this is a client side operation / no server
    intervention is required, I wrote the JavaScript below to add account number
    entered in a text box to the list control, this works fine, the client can
    enter all his accounts to the html select control, the problem is that when
    the page is posted to the server the code within the server returns no items
    within the control so I have lstCustAcc.Items.Count = 0 even on the page it
    contains some thing else >0, and I could not access any item within the
    control.

    PLEASE HELP.


    function AddAcc()
    {
    var lstLen = document.Form1.lstCustAcc.length;
    var selectedText = document.Form1.txtAccountNo.value;
    var selectedValue = document.Form1.txtAccountNo.value;
    var i;
    var isNew = true;

    if (lstLen != 0)
    {
    for (i = 0; i < lstLen; i++)
    {
    thisitem = document.Form1.lstCustAcc.options.text;
    if (thisitem == selectedText)
    {
    isNew = false;
    break;
    }
    }
    }
    if (isNew)
    {
    newoption = new Option(selectedText, selectedValue, false, false);
    document.Form1.lstCustAcc.options[lstLen] = newoption;
    }
    document.Form1.lstCustAcc.selectedIndex=-1;
    }





    Thanks in advance,
    Suhail
    Suhail A, Salman, Aug 13, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Chau
    Replies:
    0
    Views:
    599
    Andy Chau
    Nov 20, 2003
  2. =?Utf-8?B?Sm9l?=

    HtmlSelect control not showing ListItems

    =?Utf-8?B?Sm9l?=, Dec 14, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    643
    =?Utf-8?B?RGF2aWQgQnJhbmNo?=
    Dec 14, 2005
  3. globalrev
    Replies:
    3
    Views:
    1,096
  4. Alex

    HtmlSelect or ListBox control

    Alex, Sep 12, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    117
  5. Harry Keck
    Replies:
    0
    Views:
    231
    Harry Keck
    Jan 27, 2005
Loading...

Share This Page