Is there a way to do low-level debugging of ASP.NET PostBacks

房东的猫 提交于 2019-12-23 02:58:13

问题


I'm having a problem with a user control I'm developing which contains a ListView bound to an ICollection<T> and a DataPager. What I'm finding is that when the pager links are clicked, a PostBack is initiated and the Page_Load and Page_PreRender events are hit, but my DataPager's PagePropertiesChanging event handler method is never fired. The control I'm developing is used in a Sitecore website which may possibly be causing ClientID's to get messed up preventing postback events to be handled correctly.

What I want to know is if there is any way to debug, at a low-level, the postbacks to see how postback information is mapped to the different event handlers.

I've already seen the following questions but they don't seem have a solution to this problem. Question 1, Question 2.

Also this bug reported about the ListView.


回答1:


Did you check against this issue?

Gridview empty when SelectedIndexChanged called

Further reading

typesThatShouldNotBeExpanded




回答2:


Personally I'd set up a new test in your favourite testing framework (you are writing unit tests...right?) and mock out the HttpContext so as to easily test what's going on when you're initiating your postbacks.

This way you'll be able to see exactly what's going on at each step of the postback.

You'll be able to do a couple of interesting things this way. Firstly you'll be able to send the data in the same way that your web app is doing so, and secondly you'll be able to easily modify the data being sent to see which parts of it might be causing certain problems (such as ClientID's as mentioned above).



来源:https://stackoverflow.com/questions/4624306/is-there-a-way-to-do-low-level-debugging-of-asp-net-postbacks

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