如何从客户端事件触发服务器端事件?

时间:2021-08-26 15:53:24

Short version

All I need is that, in a ModalPopUp, when the DoubleClick event of a ListItem fires, the click event of my OK button should be executed.

我需要的是,在ModalPopUp中,当ListItem的DoubleClick事件触发时,应该执行我的OK按钮的click事件。

Detail

I have a ModalPopUpExtender, which hosts a user control. The user control has an OK and a Cancel button. Along with that, it has a dynamic ListBox added to it. So far, I've considered the following possible solutions:

我有一个ModalPopUpExtender,它托管一个用户控件。用户控件有一个OK和一个Cancel按钮。除此之外,它还添加了一个动态ListBox。到目前为止,我已经考虑了以下可能的解决方案:

  1. Use Ajax.Net. But, I cannot afford to have a WebMethod.
  2. 使用Ajax.Net。但是,我买不起WebMethod。

  3. Use a ClientScriptCallBack. This will need a lot of JavaScript, since I have made almost every control dynamic.
  4. 使用ClientScriptCallBack。这将需要大量的JavaScript,因为我几乎每个控件都是动态的。

Is there any other way apart from using an UpdatePanel?

除了使用UpdatePanel之外还有其他方法吗?

1 个解决方案

#1


Have a look at this way using __doPostback

使用__doPostback看看这种方式

calling a VB.net function from javascript

从javascript调用VB.net函数

#1


Have a look at this way using __doPostback

使用__doPostback看看这种方式

calling a VB.net function from javascript

从javascript调用VB.net函数