1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

ASP VBscript public sub help

Discussion in 'C#' started by StealthRT, Jan 28, 2007.

  1. #1
    Hey all i need a way for the user, when they choose a store from a cbobox to populate another cbobox depending on what the user choose in the first cbobox.

    I cant seem to execute a public sub once i put the onchange="" on the first cbobox.

    
    <select name="cboSelect" class="FieldStyleDropDown" id="cboSelect" onchange="FillBox">
            <option value=" "> </option>
            <option value="GP">Gunbarrel Point</option>
          </select>
    
    Code (markup):
    
    <%
    Public Sub FillBox()
    blah blah blah...
    %>
    
    Code (markup):
    Am i leaving something out???

    Thanks! :)
    David
     
    StealthRT, Jan 28, 2007 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    OnChange is a javascript handler (client-side). You would need to use a javascript Function called FillBox()

    <script language="javascript">
    function FillBox() {
    var ddb = document.getElementById("cboSelect"); //Handle to the DOM of the DropDown Box.
    ddb.whateverYouWantToDo;
    }
    </script>
     
    ccoonen, Jan 28, 2007 IP
  3. StealthRT

    StealthRT Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the reply ccoonen

    Problem is that i have a lot of stuff within the FillBox sub. Like gathering data from my mySQL server and such. Is there any way to call the asp sub using the javascript?

    David
     
    StealthRT, Jan 28, 2007 IP
  4. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #4
    Hmm, you could incorporate some Ajax, but I would say your best solution is to do a physical postBack. Then on next page load - fill the box, do your db interactions, etc... You don't need to do it in a function then. A good easy detection method is to post with a querystring like <form method="post" action="default.asp?submit=true"> then you do if trim(lcase(request.querystring("submit"))) = "true" then Run your Code.
     
    ccoonen, Jan 28, 2007 IP
  5. StealthRT

    StealthRT Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Another problem... its a log in page... its needed from the user.

    :(

    David
     
    StealthRT, Jan 28, 2007 IP
  6. StealthRT

    StealthRT Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ajax would be fine if u have some sample code that is :)

    David
     
    StealthRT, Jan 28, 2007 IP
  7. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #7
    Hmm, ok - I think we could find something for you - what technolog are you using? classic asp? I know asp.net AJAX was just released (a layer on top of asp.net) if you are going that route, otherwise we can work something out for for classic asp

    This is some AJAX I did about 2 years ago... if it helps you out to have an example :)

    http://www.dataweigh.com/order/view_order.asp - You'll see the dropdown lists's values change when you select a different dropdown value.
     
    ccoonen, Jan 28, 2007 IP
  8. StealthRT

    StealthRT Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Hey thanks for the example - that is what i need mine to do.

    Yep, im old so im using the classic ASP :)

    David
     
    StealthRT, Jan 28, 2007 IP
  9. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #9
    No problem, Classic ASP is the best way to get the cleanest markup anyways :)
     
    ccoonen, Jan 28, 2007 IP
  10. StealthRT

    StealthRT Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Well im ready whenever u have the time ccoonen :)

    David
     
    StealthRT, Jan 28, 2007 IP
  11. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #11
    ccoonen, Jan 28, 2007 IP
  12. StealthRT

    StealthRT Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    :confused:

    Oh boy..

    David
     
    StealthRT, Jan 28, 2007 IP
  13. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #13
    HEHE, The second one is pretty easy follow, it might be a good starting point - then move on to my example which uses comboboxes... I could ofcourse do a real example for you (for a price) lol
     
    ccoonen, Jan 28, 2007 IP
  14. StealthRT

    StealthRT Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    How much would it be worth to you? If you have paypal then i may consider it...

    David
     
    StealthRT, Jan 28, 2007 IP