且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从同一页面上的按钮访问gridview控件

更新时间:2023-12-03 09:15:52

单击按钮将导致回发,该回发将执行逻辑数据绑定网格并因此再次触发此事件.

您需要做的是设置类级别的变量,您可以在RowDataBound事件处理程序方法中检查该变量,并适当地设置控件.
The button click will cause a postback which will execute the logic for data binding the grid and thus triggering this event again.

What you need to do is set class level variable that you can check in the RowDataBound event handler method and set the controls appropriately.