简体   繁体   English

如何获取回发时要在Page_Load方法中使用的元素的值?

[英]how to get value of an element at point of postback to use in Page_Load method?

I'm writing an ASP.NET form which uses a custom web service to populate a table based on values (the specifics of this are not important). 我正在编写一个ASP.NET表单,该表单使用自定义Web服务根据值填充表(此表的细节并不重要)。

On the page are two ASP.NET Calendar controls, what I want to be able to do is make use of the AutoPostback behaviour of these to make a new web service call each time the SelectedDate of one of these changes, using its value as an input parameter. 页面上有两个ASP.NET日历控件,我要能够做的就是利用这些控件的AutoPostback行为,每次在其中一个更改的SelectedDate处进行一次新的Web服务调用,都将其值用作输入参数。

Currently I set the value of the controls in the Page_Load (in an if (!Page.IsPostBack){} statement), and the first web service call includes both of these values. 当前,我在Page_Load设置控件的值(在if (!Page.IsPostBack){}语句中),并且第一个Web服务调用包括这两个值。 If one of these calendars is updated, I want a new web service call to be made, with the Submitted value from the calendar as a parameter, currently I can't get the request to contain anything but the initial value, which was set on the first page load. 如果更新了这些日历之一,则我希望使用日历中的Submitted值作为参数进行新的Web服务调用,目前我无法获得除初始值(该初始值已设置)之外的任何请求第一页加载。

您是否尝试过在日历控件的on_changed事件中放置用于调用Web服务的代码?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM