Passing page control from jscript to pagemethod in the codebehind?
Posted
by brandonprry
on Stack Overflow
See other posts from Stack Overflow
or by brandonprry
Published on 2010-04-24T16:50:25Z
Indexed on
2010/04/24
16:53 UTC
Read the original article
Hit count: 189
Hi, I am looking write a javascript method as such called when a dropdownlist changes value
function GetStuff(sender, destID){
var dest = document.getElementById(destID);
this.PageMethods.GetStuffs(sender, dest, null, null);
}
GetStuffs() is in the Codebehind as follows:
[WebMethod]
public static void GetStuffs(object sender, object dest)
{
DropDownList s = sender as DropDownList;
DropDownList d = dest as DropDownList;
d.Items.Add(new ListItem(s.SelectedValue));
}
I have a break point set at the method and alerts in the GetStuff() jscript method fire up until the PageMethod call, at which nothing happens. I have set OnSuccess and OnFailure methods up with alerts and they don't get fired.
Any thoughts? Am I doing something inherently wrong?
© Stack Overflow or respective owner