两个网格使用相同的按钮事件 [英] Two Grid Use Same Button Event

查看:99
本文介绍了两个网格使用相同的按钮事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的aspx页面中,我有两个网格..

两个网格都包含相同的按钮显示...在页面上一次加载一个网格显示..
按钮事件仅适用于一个网格而不适用于其他网格...


我们如何通过gridview

In my aspx page i have two grid..

both grid contain same button show ... on page load one grid show at a time ..
the button event work for one grid not for other...


how we can call same button event by both gridview

推荐答案

两者调用相同的按钮事件而无法看到您的代码,很难真正理解您要执行的操作.但是总的来说,如果您希望两个不同的控件执行相同的代码,则可以将两者都添加到事件处理程序的Handles部分中.例如,如果您具有Button1和Button2,并且希望它们在单击时做出完全相同的思考,那么您将得到以下信息:
(在VB中,但是您应该能够看到我在说什么)
Without being able to see your code, it''s hard to really understand what you are trying to do. But in general, if you want two different controls to perform the same code you can just add both to the Handles part of the Event Handler. For example, if you have Button1 and Button2 and you want them to do the exact same think when clicked you would have this:
(It''s in VB, but you should be able to see what I''m talking about)
Private Sub Buttons1and2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click
   'Code that both buttons should perform when clicked
End Sub


这篇关于两个网格使用相同的按钮事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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