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.

Problem in Calling ASP Function from OnChange Event

Discussion in 'C#' started by neurohari, Nov 16, 2005.

  1. #1
    Hai All,

    I have written a asp function within <%.....%>.
    I need to call this function whenever user changes the value of a drop down.
    my code seems like below onw.
    <html>
    <head>
    <%
    sub ASPFunc()
    ...
    ...
    end sub
    %>
    </head>
    <body>
    <select name="select1" onChange="<% ASPFunc %>">
    <option>some value</option>
    <option>some value</option>
    <option>some value</option>
    </select>
    --------------
    but this code is not working ..... and that function is not called for ever.


    But if put the code " <% ASPFunc %> " some where outside the tags and inside the body...its working..

    I want this script to be executed from OnChange Event

    Can any one help me out on this..

    Thanks in Advance
     
    neurohari, Nov 16, 2005 IP
  2. hnn

    hnn Peon

    Messages:
    91
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This is not possible.... :/

    You need to reload the page...
    Or even better, replace the ASP code with JS or something..
     
    hnn, Nov 16, 2005 IP
  3. neurohari

    neurohari Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks a lot for your earliest response

    ..
    I have tried the alternate way of reloading the page using form.submit().

    Its working fine when i have only 1 drop down in the page.

    But in my page it should have a set of drop downs, each one will be loaded dynamically based on the previous drop downs selections.

    So each and every time do i need to reload the page...

    If i do so then, each time i reload the previous drop down values which were selected by user is also getting reloaded and initialised.

    Here i need to take care of keeping the selected value each time page reloads.

    Is there anyother way ??
     
    neurohari, Nov 16, 2005 IP
  4. vectorgraphx

    vectorgraphx Guest

    Messages:
    545
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #4
    hnn was right dude, asp = "active SERVER pages"... it's exclusively parsed server-side. what you're wanting to do requires client-side scripting, such as javascript. there are many free resources out there for javascripts, here's a couple links:

    http://dynamicdrive.com/

    http://javascript.internet.com/

    By the way, welcome to DP :D
     
    vectorgraphx, Nov 17, 2005 IP
  5. neurohari

    neurohari Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks VectoGraphx.. for your help.

    When i surfed thru javascript.internet.com i found a way to load serials of drop down dynamically...

    in that script they have used Array to store all value that will be loaded dynamically.

    But its possible when the drop downs have less number of values and less number corresponding values that will be loaded dynamically based upon the selections.

    In my page, a drop down some large amount of values and each value will load another drop down with large number values..

    It will be a too messy to store all those values in Array rt??

    I have stored all those things in Data base.

    I need to load from there...

    Can use ASP script... But need to use reloading of page..
    its possible for few drop downs..

    Cannot use page reloading when i have a lot of drop downs in that page

    Please help me out..............................
     
    neurohari, Nov 17, 2005 IP
  6. vectorgraphx

    vectorgraphx Guest

    Messages:
    545
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #6
    thats hard to say man, i've seen a lot of "messy" arrays that function fine on the user end. are we talking thousands and thousands of values? hundreds? if i were you i would go ahead and build your "messy" array and take a look at your filesize, see if it's too large to facilitate fast page loading. it'll have to be a judgement call, though a few extra array objects shouldn't increase your filesize so much that it will keep people from loading your page.

    It's relative, and i guess you'll have to consider the size of your recordset, and for that matter your target demographic and their browsing habits, in order to determine the best course of action here.

    VG
     
    vectorgraphx, Nov 18, 2005 IP
  7. BurgerKing

    BurgerKing Active Member

    Messages:
    397
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Hi,

    Sounds like a job for ajax...(and a good time to start using ASP.Net)

    But if you are using ASP, then you have to manually repopulate the form like everyone has been saying.

    A quick look around turned this up, which has the full source code to a dependant combo demo. Hope it helps

    http://www.codecomments.com/archive288-2004-10-299532.html
     
    BurgerKing, Nov 20, 2005 IP
  8. neurohari

    neurohari Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thanks a lot all.

    I got all this worked.
    I used JavaScript, stored all Drop Down values in Array itself...it was messy though..
    JS is great

    Once again thanks for your efforts to help me out
     
    neurohari, Nov 22, 2005 IP