How can I determine if a DataGrid has been sorted or paged, prior to the events being triggered?

此生再无相见时 提交于 2020-01-17 04:16:08

问题


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?

These events will fire just fine after page_load, but I'd like to know at page_load if they are to be fired.


回答1:


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.



来源:https://stackoverflow.com/questions/3120268/how-can-i-determine-if-a-datagrid-has-been-sorted-or-paged-prior-to-the-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!