Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2002
    Posts
    5

    Unanswered: How to populate database vale in drop down with refreshing screen

    Hi Guy's
    I have a problem in populating database data in dropdowm box.

    I had 4 drop down box and 4 table, based on first drop down selection second dropdown value should get populate,based on second 3'rd drop down should get populate and based on 3'rd dropdown selection 4'th drop down should get populate.

    Condition,
    No refresh of screen.I know it can be done using javascript but i am not getting any clear idea how to achieve it.I am using asp on server side and javascript on client side.

    Thanks in advance.

    Sharad

  2. #2
    Join Date
    Jul 2002
    Posts
    55
    You need to use DHTML (and your client browser needs to support it) and write out a LOT (probably) of client-side JavaScript to populate the second, third and fourth <select /> boxes.

    The alternative, if you want to be REALLY fancy, is to use active scripting but then you're into a whole set of different issues.

    This should get you started with dynamically adding items to a <select /> list.

  3. #3
    Join Date
    Nov 2002
    Location
    Houston, Texas
    Posts
    85

    DHTML is probably the answer...

    I agree with the previous poster -- DHTML (CSS and Javascript) is probably the way to go.

    In your first dropdown (SELECT tag), how many options are there? How many in the second dropdown?

    In short, how many possible combinations are there? And, more importantly, how are these related? For instance, do you relate them using their index number, or does the value tell us the name of the next menu that will appear?

    One approach might be to, when the page is first loaded. create each dropdown and put them inside a DIV tag with the display to none (ex. document.all.divName.style.display = "none"). Then, attach an onChange event handler to the first dropdown so that, when the user changes it, it pulls the name of the next dropdown out of its value property and triggers that dropdown to become visible.

    The code itself is not really that hard... But the logic and planning might be VERY complicated, depending on how many different dropdown combinations are possible.

    Good luck.

  4. #4
    Join Date
    Dec 2002
    Posts
    1
    In order to do this without postback, all data needs to be sent into your DHTML in some manner. With the .NET framework, the postbacks are relatively simple. If you are not limited by the connection speed, you should consider a postback.

  5. #5
    Join Date
    Nov 2002
    Location
    Houston, Texas
    Posts
    85

    Postback?

    I'm not up to speed on .NET. What's a postback? Is it cool, and does it allow you to pull data back to the page without refreshing the page?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •