Populate two textboxes based on the values of a Dropdown List Using AJAX

Last post 10-24-2008 4:25 PM by iamhers. 1 replies.

Sort Posts:

  • Populate two textboxes based on the values of a Dropdown List Using AJAX

    10-24-2008, 3:42 PM
    • Member
      18 point Member
    • srkvellanki
    • Member since 02-25-2005, 5:41 AM
    • Posts 66

     Hi All,

        This is my first AJAX application.I want to Populate two textboxes based on the value of a Dropdown List Using AJAX.Pls guide me on this.

     

    Regards

    SriRam

  • Re: Populate two textboxes based on the values of a Dropdown List Using AJAX

    10-24-2008, 4:25 PM
    Answer
    • Member
      322 point Member
    • iamhers
    • Member since 11-28-2007, 5:46 PM
    • Posts 81

    Hello SriRam,

    Here are a few resources:

    http://aspalliance.com/716_Populating_a_DropDownList_using_AJAX_and_ASPNET.4

    http://roshanbh.com.np/2008/09/change-textbox-value-dropdown-list-ajax-php.html

    http://www.w3schools.com/HTMLDOM/prop_option_value.asp

    This last one here is the code:

    <html>
    <head>
    <script type="text/javascript">
    function alertValue()
      {
      var x=document.getElementById("mySelect").selectedIndex;
      alert(document.getElementsByTagName("option")[x].value);
      }
    </script>
    </head>
    <body><form>
    Select your favorite fruit:
    <select id="mySelect">
      <option value="apple">Apple</option>
      <option value="orange">Orange</option>
      <option value="pineapple">Pineapple</option>
      <option value="banana">Banana</option>
    </select>
    <br /><br />
    <input type="button" onclick="alertValue()"
    value="Alert selected value">
    </form></body>
    </html>

    The main idea for getting any value in AJAX- is to raise an event on a control, and have a function it calls. The main element for getting access to the control is GetElementBy...

     

    Any other questions let me know,

    Jeremy

    Please mark post if this helped, so as to help others - Thanks

Page 1 of 1 (2 items)