网格视图的 rowdatabound 后触发按钮单击事件

发布于 2024-07-12 13:29:20 字数 154 浏览 3 评论 0原文

当我单击 ASP.NET 页面中 GridView 之外的按钮时,GridView rowdatabound 事件将在该按钮的 OnClick 事件之前触发。 我正在使用自定义分页按钮,因此我需要颠倒这些事件的顺序。 有什么想法吗 ??

提前致谢, ——阿米特

When I click on a button which is outside of the GridView in my asp.net page, the GridView rowdatabound event is getting fired before OnClick event for the button. I am using the button for custom paging so I need to reverse the order of these events. Any thoughts ??

Thanks in Advance,
- Amit

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你是年少的欢喜 2024-07-19 13:29:20

可能是因为您在 Page_Load 事件中调用 GridView 上的 DataBind()。 您应该注意, Page_Load 将始终在引发回发的事件之前被调用...在您的情况下为 Button_Click

我建议阅读 ASP.NET 页面生命周期来学习更多的。

Possibly because you are calling DataBind() on the GridView in the Page_Load event. You should note that Page_Load will always be called before the event that raised the postback... the Button_Click in your case.

I suggest reading up on the ASP.NET Page Life cycle to learn more.

庆幸我还是我 2024-07-19 13:29:20

也许你的gridview enableviewstate = false

perhaps your gridview enableviewstate = false

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文