调用Gridview事件 [英] Calling Gridview Event

查看:58
本文介绍了调用Gridview事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要调用gridview事件,例如:

I need to call gridview event such as:

GridView1_RowDataBound(object sender, GridViewRowEventArgs e)



单击按钮后或从页面中的任何区域单击.



after button click or from any region in the page.
How to do it?

推荐答案

您需要在要执行的事件上绑定要调用的Gridview 方法,或者调用Gridview 方法在您的按钮中单击处理程序.

只是需要确保在调用特定方法时传递有效参数.

就像在单击按钮时调用GridView1_RowDataBound(object sender, GridViewRowEventArgs e)一样,需要您确保通过正确的GridViewRowEventArgs.
You need to bind the Gridview method to be called at the events you want it to be executed OR call the Gridview method in your button click handler.

It''s just that you need to make sure you pass valid parameters while calling a particular method.

Like, calling GridView1_RowDataBound(object sender, GridViewRowEventArgs e) on button click, would need you to make sure you pass proper GridViewRowEventArgs.



怎么样
How about

int rowIndex = 5;
int colIndex = 1;
GridView1_CellClick(this.gridView1, new DataGridViewCellEventArgs(colIndex - 1, rowIndex - 1));


这篇关于调用Gridview事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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