Greetings.
Is there a good way to determine what is calling my Page_Load method? I've got a few Componentart WebUI grids that call it, although I've checked all of those (using the gridName.IsCallback property). I've also got an update panel, but I'm not sure how to check if it is the caller.
有没有一种很好的方法来确定调用我的Page_Load方法的内容?我有一些调用它的Componentart WebUI网格,虽然我已经检查了所有这些(使用gridName.IsCallback属性)。我也有一个更新面板,但我不知道如何检查它是否是调用者。
I'm betting there is a property somewhere that will tell me.
我打赌某个地方有一处房产可以告诉我。
Thanks!
4 个解决方案
#2
I'm not sure if there's a property your program can check at run-time, but if you put in a break point and then check the stack in Visual Studio, that will probably give you enough information to figure out where it's coming from.
我不确定程序是否可以在运行时检查属性,但是如果你放入一个断点然后检查Visual Studio中的堆栈,那么可能会给你足够的信息来确定它来自哪里。
#3
Request.Form["__EVENTTARGET"] might do the trick, it contains the ID of any control other than a regular button (buttons trigger 'normal' postbacks) that triggered a postback.
Request.Form [“__ EVENTTARGET”]可能会成功,它包含触发回发的常规按钮(按钮触发'正常'回发)以外的任何控件的ID。
#4
What could cause it is controls AutoPostBack property just check controls that you have on the page and see which one has that property set One of them did it.
可能导致它的原因是控件AutoPostBack属性只是检查页面上的控件,看看哪个属性设置了其中一个做了它。
#1
Check out this blog post for GetPostbackControl.
查看此博客文章了解GetPostbackControl。
#2
I'm not sure if there's a property your program can check at run-time, but if you put in a break point and then check the stack in Visual Studio, that will probably give you enough information to figure out where it's coming from.
我不确定程序是否可以在运行时检查属性,但是如果你放入一个断点然后检查Visual Studio中的堆栈,那么可能会给你足够的信息来确定它来自哪里。
#3
Request.Form["__EVENTTARGET"] might do the trick, it contains the ID of any control other than a regular button (buttons trigger 'normal' postbacks) that triggered a postback.
Request.Form [“__ EVENTTARGET”]可能会成功,它包含触发回发的常规按钮(按钮触发'正常'回发)以外的任何控件的ID。
#4
What could cause it is controls AutoPostBack property just check controls that you have on the page and see which one has that property set One of them did it.
可能导致它的原因是控件AutoPostBack属性只是检查页面上的控件,看看哪个属性设置了其中一个做了它。