Hi All,

Im in the process of creating a task logging system for where i work, and at the moment im in the process creating a ajaz function where it will return a list of all users depending on what team the user has selected from the 1 dropdownlist but unfortunatly im having a bit of trouble calling the javascript function and passing in the selected value from the TeamsDropDownList

Heres my HTML

<div class="RightBoxPopUpBussinessAnalyst">
                <asp:DropDownList ID="cmbBAAllocatedTeam" runat="server" AutoPostBack="true" onchange="javascript:GetTeamUsersByTeamID('MainDisplayContentChange_DropDownList5');">
                    <asp:ListItem>Business Analyst</asp:ListItem>
                    <asp:ListItem>Lansa Davelopment</asp:ListItem>
                    <asp:ListItem Value="214">.Net</asp:ListItem>

As you can see the last listitem has a value of 214 this is the one im using for testing and you can also see the onchange passing in the ID of the dropdown is that correct?

Javascript function

function GetTeamUsersByTeamID(field) 

im passing in the field name, then using document.getElementById to get the value of the field i have passed in, but i keep getting this error "value is not defined" thats within the javascript file, is there a simpler way of doing this such of thing, the getUserTeamProperties is the start of the ajax but it falls over after entering the GetTeamUserByTeamID,

And just for your information im sure your aware the 'MainDisplayContentChange_DropDownList5' is the name of the dropdownlist when the ASP.NET Application is running well according to the source page it is.
Thanks in advance

Edited by Scott.Atkinson: n/a

5 Years
Discussion Span
Last Post by Scott.Atkinson

You should have to append an attribute is code-behind.

          cmbBAAllocatedTeam.Attributes.Add("onchange", "GetTeamUsersByTeamID('" + DropDownList2.ClientID + "')");

Can i no just reference the value within javascript im trying this at the moment but it keeps saying object expected

function GetTeamUsersByTeamID(field) 
    var e = document.getElementById('field'); // select element
    var strUser = e.options[e.selectedIndex].value;

as you can see im passing in the field name from the HTML above
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.