admin管理员组文章数量:1417070
I'd like to invoke a button click event on an ASP page programmatically, using c#. I don't have access to the server-side of the page, so i can't invoke the function directly. Is it possible at all?
I'd like to invoke a button click event on an ASP page programmatically, using c#. I don't have access to the server-side of the page, so i can't invoke the function directly. Is it possible at all?
Share Improve this question asked Jan 4, 2010 at 11:51 Danny YoffeDanny Yoffe 211 silver badge4 bronze badges 03 Answers
Reset to default 3in your script, call:
__doPostBack("<%= your_button_id.UniqueID %>", "");
As far a s I understand your question:
- you cannot really generate a serverside event call from the client side.
- you can force post back by using a submit button
- BUT using
javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(...))
may fit your need. This is the JS call that an ASP control use. copying that call may "invoke" the method you need
read more here: WebForm_PostBackOptions documentation
Enjoy!
Thanks for the answers,
I've used "Tamper Data" add-on for Firefox to see how the generated Post looks like, and built HttpWebRequest of my own.
本文标签: cInvoking button click on ASPnet client side programmaticallyStack Overflow
版权声明:本文标题:c# - Invoking button click on ASP.net client side programmatically - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745260135a2650319.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论