Scott.Atkinson
09-15-2011, 09:29 AM
Hi All,
i have a adp:dropdownlist which holds text and its value im having trouble passing the selected value to a javascript function which then in turn will perform a ajax call that will go to the SQL and return all user that have the TeamID im passing in.
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>
</asp:DropDownList>
</div>
the last listitem is the one im using for testing and im trying to call the function of a "onchange event" which you can also see in the above html
the javascript looks like this
function GetTeamUsersByTeamID(field) {
FieldElement = document.getElementById(field);
destElement.value = FieldElement(FieldElement.selectedIndex).value;
getUserTeamProperties(document.getElementById(field).value);
}
function GetTeamUserProperties(intTeamID) {
////USE AJAX TO GET THE USER TEAM PROPERTIES
var requestUrl = "AJAX/GetTeamUserProperties.aspx?TeamID=" + intTeamID;
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
alert("Your browser does not support AJAX!");
return;
}
else {
//Setting the event handler for the response
xmlHttp.onreadystatechange = UserTeamPropertiesReturned;
//Initializes the request object with GET (METHOD of posting),
xmlHttp.open("GET", requestUrl, true);
//Sends the request to server
xmlHttp.send(null);
}
}
the first function it calls is GetTeamUsersByTeamID which then finds out what value which is the TeamID of 214 that has been selected and then calls the second function and passed in that value which starts the ajax call but on the first line of GetTeamUsersByTeamID i get 'value is underfined' and im sure what im doing wrong here.....im new to javascript so please bare with me :(
Hope someone can help and i look forward to your reply,
Thanks
i have a adp:dropdownlist which holds text and its value im having trouble passing the selected value to a javascript function which then in turn will perform a ajax call that will go to the SQL and return all user that have the TeamID im passing in.
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>
</asp:DropDownList>
</div>
the last listitem is the one im using for testing and im trying to call the function of a "onchange event" which you can also see in the above html
the javascript looks like this
function GetTeamUsersByTeamID(field) {
FieldElement = document.getElementById(field);
destElement.value = FieldElement(FieldElement.selectedIndex).value;
getUserTeamProperties(document.getElementById(field).value);
}
function GetTeamUserProperties(intTeamID) {
////USE AJAX TO GET THE USER TEAM PROPERTIES
var requestUrl = "AJAX/GetTeamUserProperties.aspx?TeamID=" + intTeamID;
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
alert("Your browser does not support AJAX!");
return;
}
else {
//Setting the event handler for the response
xmlHttp.onreadystatechange = UserTeamPropertiesReturned;
//Initializes the request object with GET (METHOD of posting),
xmlHttp.open("GET", requestUrl, true);
//Sends the request to server
xmlHttp.send(null);
}
}
the first function it calls is GetTeamUsersByTeamID which then finds out what value which is the TeamID of 214 that has been selected and then calls the second function and passed in that value which starts the ajax call but on the first line of GetTeamUsersByTeamID i get 'value is underfined' and im sure what im doing wrong here.....im new to javascript so please bare with me :(
Hope someone can help and i look forward to your reply,
Thanks