句柄按钮单击事件里面gridview [英] handle button click event inside gridview

查看:169
本文介绍了句柄按钮单击事件里面gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中编写asp.net项目。

I am writing asp.net project in C#.

页面由gridview组成,最初从数据库填充。

The page consists of gridview, it is filled from database initially. The buttons, textboxes and dropdownlists are inside gridview as in the picture picture.

我想处理按钮(сообщить)点击事件,以便我知道gridview的哪一行被点击为了获得所选的值dropdowlnist和textbox的值来更新数据库。

I want to handle button(сообщить) click event so that I know what row of gridview is clicked in order to get the selected value of dropdowlnist and value of textbox from that row to update the database.

有人知道如何做吗?
谢谢!

Does someone know how to do this? Thanks!

推荐答案

我的第一个想法是,如果你使用< asp :TemplateField> 标签在你的gridview页面,那么你应该能够注册一个事件在你的按钮代码如下:< asp:Button runat =serverOnClick = MyOnClickEvent/> 。如果你以编程方式添加它们,你应该能够使用按钮的onClientClick属性。

My first thought is that if you are using the <asp:TemplateField> tags inside your gridview page, then you should be able to register an event in your button code as such: <asp:Button runat="server" OnClick="MyOnClickEvent" />. If you are programmatically adding them, you should be able to use the onClientClick property of the button.

尝试阅读 http://www.codeproject.com/Articles/50540/GridView-Event-Handling 。它可能指向正确的方向。

Try reading http://www.codeproject.com/Articles/50540/GridView-Event-Handling. It might point you in the right direction.

这篇关于句柄按钮单击事件里面gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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