事件被触发之前,我如何确定DataGrid是否已排序或分页? [英] How can I determine if a DataGrid has been sorted or paged, prior to the events being triggered?
问题描述
我有一个 DataGrid
具有绑定到 SortCommand
和 PageIndexChanged
。如何确定这些事件处理程序是否即将被调用,比如page_load?
I have a DataGrid
that has event handlers bound to SortCommand
and PageIndexChanged
. How can I determine if those event handlers are about to be called, say on page_load?
这些事件在page_load之后会很好地启动,但是我想知道page_load如果它们被触发。
These events will fire just fine after page_load, but I'd like to know at page_load if they are to be fired.
推荐答案
Request.Form [__ EVENTTARGET]
和 Request.Form [__ EVENTARGUMENT]
将给出导致返回的对象和事件参数。如果数据网格不会导致回发,那么在帖子中可能会有一个值。使用Fiddler查看点击按钮时发送的请求。
Request.Form["__EVENTTARGET"]
and Request.Form["__EVENTARGUMENT"]
will give the object causing the post back and the event argument. If the data grid does not cause the postback, then there is likely a value somewhere in the post. Use Fiddler to look at the request being sent when the button is clicked.
这篇关于事件被触发之前,我如何确定DataGrid是否已排序或分页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!