如何在asp.net中的gridview的锚标记上触发click事件 [英] how to fire click event on anchor tag of gridview in asp.net

查看:80
本文介绍了如何在asp.net中的gridview的锚标记上触发click事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经通过sqlserver绑定了gridview.在网格的3列标题,描述,名称中.我已经绑定标题并添加了vediolink以便在此标签上播放.但是我想单击锚点播放视频,并在GridView之外的标签控件上显示描述,因为描述绑定在GridView中,但我没有显示在网格中,而是显示在标签控件上.请帮我.


在此先感谢

Hi,

I have been bind gridview through sqlserver. In grid 3 columns Title,Description,Name. I have been bind title through and add on vediolink for play on this tag. But I want to click on anchor play vedio and show description on label control which that out of GridView, because description is bind in GridView but I haven''t display in grid, it displays on label control. Pleas help me.


Thanks in advance

推荐答案

答案非常普遍,适用于所有事件和应用程序类型.

这是东西.您可以在声明此事件的类中调用事件 only . 您无法在其他任何地方直接调用事件,即使在派生类中也是如此.与常规"委托实例相比,这是事件的重要限制之一,并且是重要的防呆功能.

我在最近的回答中对此进行了解释.请参阅:
由于我们有多播委托,所以为什么我们需要事件吗? [ ^ ].

那么该怎么办?实际上,不仅您不能从已声明的类外部调用事件,而且在实践中也永远不需要它.您真正想要的不是事件的调用,而是获得与调用事件相同的效果" .

因此,您需要做一个非常简单的事情.您需要声明一些方法,然后在两个(或多个)不同的地方调用它.一个呼叫将来自您的事件处理程序;并且此调用应实现您希望或已对事件进行响应的行为.另一个呼叫将来自您想要产生相同效果的某个地方,或者是您想要模拟该事件的某个地方.

请查看我最近关于如何操作的答案:
c#联网窗口表单 [
The answer is very general and universal, applies to all events and application types.

Here is the thing. You can invoke event only in the class where this event is declared. You cannot directly invoke an event nowhere else, not even in derived class. This is one of the important limitations of events, as compared to "regular" delegate instances, and important fool-proof feature.

I explained it in my recent answer. Please see:
Since we have multicast delegates, why do we need events?[^].

So, what to do? In fact, not only you cannot invoke an event from outside a declared class, you never need it in practice. What you really want is not the invocation of the event, but getting "the same effect as if an event was invoked".

Therefore, you need to do a really simple thing. You need to declare some method and call it in two (or more) different places. One call would be from your event handler; and this call should implement the behavior you want or already have in response to the event. Another call would be from some place where you want to have the same effect, some place where you want to simulate the event.

Please see my recent answer on how can you do that:
c# networking windows form[^].

—SA


这篇关于如何在asp.net中的gridview的锚标记上触发click事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆