【发布时间】:2014-04-07 18:01:26
【问题描述】:
您好,我尝试更改 ddl.selectedIntex=1,我看到 ddl 的值正在更改,但事件 ddl.change 不起作用。
$("#ctl00_PlaceHolderMain_AccountsDDL_ddlAccounts")[0].selectedIndex = 1;
这只是设置值,但我需要运行 .change 函数
有什么想法吗? 我在控制台中尝试了这个,所有的工作都很好,你知道我怎么能通过将 PostData 传递给 HttpWebRequest 来做到这一点?
我在控制台中尝试了这个,一切都很好,你知道我怎么能通过将 PostData 传递给 HttpWebRequest 来做到这一点 我添加了我的代码
HttpWebRequest postRequest = (HttpWebRequest)WebRequest.Create("https://www.com/Pages/current.aspx");
PostString += "ctl00$PlaceHolderMain$AccountsDDL$ddlAccounts=" + Number + "&";//Here
byte[] byteArray = Encoding.ASCII.GetBytes(PostString);
postRequest.ContentLength = byteArray.Length;
Stream newStream = postRequest.GetRequestStream();
newStream.Write(byteArray, 0, byteArray.Length);
newStream.Close();
HttpWebResponse postResponse = (HttpWebResponse)postRequest.GetResponse();
【问题讨论】:
-
使用
__doPostBack('ctl00_PlaceHolderMain_AccountsDDL_ddlAccounts','');或$("#ctl00_PlaceHolderMain_AccountsDDL_ddlAccounts").change() -
我在控制台中试试这个,一切都很好,我可能知道如何通过将 PostData 传递给 HttpWebRequest 来做到这一点?
标签: c# javascript jquery html asp.net