如何在更新面板中的gridview中触发按钮的单击事件 [英] how to fire click event of button in gridview which is in update panel

查看:107
本文介绍了如何在更新面板中的gridview中触发按钮的单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Webform,其中有两个面板.
一个用于插入数据(插入表单),在第二个面板中,我具有gridview.
我在updatepanel中使用了gridview.在gridview我有一个按钮.在按钮上单击我要在面板1表单上发送行详细信息.但是我不能这样做,因为click事件不是按钮触发的事件.

因此,请告诉我,我该怎么做.

解决方案

您需要为此进行事件冒泡,因为子控件不会自行引发任何事件.我们需要为GridView的RowCommand事件创建一个事件处理程序.在此事件处理程序中,我们首先检查传入的CommandName值以确定引发哪个控件的事件,然后采取适当的自定义操作.本文将提供有关引发rowcommand事件的更多信息

在本文中查看转到"按钮的功能

技巧/提示:使用提交"按钮从子DropDownList控件引发GridView RowCommand事件 [ ^ ]


I希望的答案 [ 解决方案

You need to do event bubbling for this as child controls do not raise any events on its own & need to be bubbled to GridView their parent.To accomplish this, we need to create an event handler for the RowCommand event of GridView. In this event handler we first check the incoming CommandName value to determine which control''s event is raised and then take appropriate custom action.This article will give more idea on raising rowcommand event

Check out the functionality of "Go" button in this article

Trick/Tip: Raise a GridView RowCommand event from a child DropDownList control using a Submit button[^]


I hope Answer of THIS[^] thread may help you a bit towards what you are actually missing.


I''d ideally like to keep my button within the header of the Grid View.Then only it is easy to fire.


这篇关于如何在更新面板中的gridview中触发按钮的单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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