<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Web Forms</title><link>http://forums.asp.net/18.aspx</link><description>All about building ASP.NET Pages - server controls, events, validation, etc.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Stop a postback from hitting the postback event</title><link>http://forums.asp.net/thread/2400118.aspx</link><pubDate>Wed, 04 Jun 2008 08:59:32 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2400118</guid><dc:creator>kennyp</dc:creator><author>kennyp</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2400118.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=2400118</wfw:commentRss><description>RTernier, did you find a solution to this? I have a base page class which i use to check for session timeouts which works fine using standard ASP.NET events. However, when an AJAX event is fired and the session has expired the base page load event correctly determines that the page has expired, but the server side code behind the AJAX event is fired anyway. I don&amp;#39;t want to have to put code in to each event that i write to check for the session timing out. i just want prevent the server side code from running and display a popup to the user explaining what happened. Do you know if&amp;nbsp;this is possible?</description></item><item><title>Re: Stop a postback from hitting the postback event</title><link>http://forums.asp.net/thread/1948536.aspx</link><pubDate>Tue, 09 Oct 2007 22:31:45 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1948536</guid><dc:creator>RTernier</dc:creator><author>RTernier</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1948536.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1948536</wfw:commentRss><description>&lt;p&gt;For a simpler example that could be true. However my pages are dynamically created with a wide array of controls and postbacks. A user could say he wants 500 dropdown lists on a page, and all of them to have a postback event.&lt;/p&gt;&lt;p&gt;In some cases, I want to (on the page load/init/pre init) to take all those &amp;quot;control events/Page events&amp;quot; and delete them.&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Stop a postback from hitting the postback event</title><link>http://forums.asp.net/thread/1948449.aspx</link><pubDate>Tue, 09 Oct 2007 21:17:41 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1948449</guid><dc:creator>jamezw</dc:creator><author>jamezw</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1948449.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1948449</wfw:commentRss><description>&lt;p&gt;At the bottom of your Page_Load event you could add something like this:&lt;/p&gt;
&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;if&lt;/span&gt; (Page.IsPostBack)
{
    &lt;span class="kwd"&gt;this&lt;/span&gt;.Button1.Click -= &lt;span class="kwd"&gt;new&lt;/span&gt; EventHandler(Button1_Click);
    &lt;span class="kwd"&gt;this&lt;/span&gt;.DropDownList1.SelectedIndexChanged -= &lt;span class="kwd"&gt;new&lt;/span&gt; EventHandler(DropDownList1_SelectedIndexChanged);
}&lt;/pre&gt;
&lt;p&gt;Since Page_Load occurs just before the control events fire, it should stop the control event code from running but still allow the Page_Load method to execute. The removal of the event methods would have to be added for each control that causes a postback.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Stop a postback from hitting the postback event</title><link>http://forums.asp.net/thread/1948397.aspx</link><pubDate>Tue, 09 Oct 2007 20:40:20 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1948397</guid><dc:creator>MSchumacher</dc:creator><author>MSchumacher</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1948397.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1948397</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;My solution is maybe too simple, but can you use the OnClientClick event. Then you may use javascript ...&lt;/p&gt;</description></item><item><title>Re: Stop a postback from hitting the postback event</title><link>http://forums.asp.net/thread/1948323.aspx</link><pubDate>Tue, 09 Oct 2007 19:46:06 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1948323</guid><dc:creator>RTernier</dc:creator><author>RTernier</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1948323.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1948323</wfw:commentRss><description>&lt;p&gt;The 2 buttons were just an example.&lt;/p&gt;&lt;p&gt;Pretty much I have code that runs every time a postback/ajax calback takes place. I am looking for a way to keep the postback, but stop any events from the sender from fireing. ex. If someone changes a dropdown list with Autopostback=true on it, I would like to find the place where that event is held and stop it from processing... basically jsut do the page lifecycle over again without going to any Events from any control.&amp;nbsp;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Stop a postback from hitting the postback event</title><link>http://forums.asp.net/thread/1948315.aspx</link><pubDate>Tue, 09 Oct 2007 19:42:42 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1948315</guid><dc:creator>jamezw</dc:creator><author>jamezw</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1948315.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1948315</wfw:commentRss><description>&lt;p&gt;Page has button &amp;#39;A&amp;#39; and &amp;#39;B&amp;#39;. User clicks &amp;#39;A&amp;#39;. Postback code begins to execute for &amp;#39;A&amp;#39;. You want to prevent user from clicking &amp;#39;B&amp;#39; before &amp;#39;A&amp;#39; completes its postback? Am I understanding you correctly?&lt;/p&gt;</description></item><item><title>Re: Stop a postback from hitting the postback event</title><link>http://forums.asp.net/thread/1948283.aspx</link><pubDate>Tue, 09 Oct 2007 19:18:45 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1948283</guid><dc:creator>RTernier</dc:creator><author>RTernier</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1948283.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1948283</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hmm, Yea. Looking at that property it&amp;#39;s always &amp;quot;&amp;quot;. IT&amp;#39;s kinda sad I can&amp;#39;t interact with the event process at all to change what&amp;#39;s going to get hit :|&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Stop a postback from hitting the postback event</title><link>http://forums.asp.net/thread/1948275.aspx</link><pubDate>Tue, 09 Oct 2007 19:12:50 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1948275</guid><dc:creator>bmains</dc:creator><author>bmains</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1948275.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1948275</wfw:commentRss><description>&lt;p&gt;Hey,&lt;/p&gt;
&lt;p&gt;I believe button events use the __EVENTTARGET form property to store the reference to the control that cause the event.&amp;nbsp; If you wipe that out; though the reason I wonder about that is because that property gets set as the postback occurs, and so I think the server knows about it before you would be able to do anything about it.&amp;nbsp; I don&amp;#39;t know if there is another way.&lt;/p&gt;</description></item><item><title>Re: Stop a postback from hitting the postback event</title><link>http://forums.asp.net/thread/1947920.aspx</link><pubDate>Tue, 09 Oct 2007 15:59:25 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1947920</guid><dc:creator>RTernier</dc:creator><author>RTernier</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1947920.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1947920</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;That is possible, the boolean would need to be on the root page. I&amp;#39;m unfortunately using the WebSite project which doesn&amp;#39;t allow me to directly cast the page as controls/parents in different directories...&amp;nbsp; but I do have a base &amp;quot;baesPage&amp;quot; which all pages inherit that I could cast my page as that, and use the property on that page.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The only problem with that is on every event I&amp;#39;ll need a if(!_doProcessing), which is why I was wondering if I could find where ASP.NET holds the events so i could just say to the postback event &amp;quot;DIE DIE DIE!&amp;quot;.&amp;nbsp; :) &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;If I can&amp;#39;t you&amp;#39;re sugestion is a solid one. Thanks.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Stop a postback from hitting the postback event</title><link>http://forums.asp.net/thread/1947892.aspx</link><pubDate>Tue, 09 Oct 2007 15:49:51 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1947892</guid><dc:creator>bmains</dc:creator><author>bmains</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1947892.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1947892</wfw:commentRss><description>&lt;p&gt;Hey,&lt;/p&gt;
&lt;p&gt;Page_Load fires before the button click, so my thought is have a private variable as such:&lt;/p&gt;
&lt;p&gt;private bool _doProcessing = false;&lt;/p&gt;
&lt;p&gt;In page load, have your logic to determine whether you need the button click, and in the button handler, do:&lt;/p&gt;
&lt;p&gt;if (!_doProcessing)&lt;br /&gt;&amp;nbsp; return;&lt;/p&gt;
&lt;p&gt;which exits the routine and avoids processing the button click.&lt;/p&gt;</description></item><item><title>Stop a postback from hitting the postback event</title><link>http://forums.asp.net/thread/1947881.aspx</link><pubDate>Tue, 09 Oct 2007 15:44:41 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1947881</guid><dc:creator>RTernier</dc:creator><author>RTernier</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1947881.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1947881</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m looking for the way to stop a postback event&amp;#39;s method from fireing.&lt;/p&gt;&lt;p&gt;Let&amp;#39;s say I have an ImageButton and a Button. Both with their own onClick events set.&amp;nbsp; During a postback I want to arbitrarily cancel the controls &amp;quot;on click&amp;quot; event from fireing before it hits it.&lt;/p&gt;&lt;p&gt;So, If someone clicks on my IMageButton, I might want to say in the PageLoad; &amp;quot;Ok, continue processing this page like it was just a regular postback without hitting the &amp;quot;onImageButton_Click&amp;quot; event.&lt;/p&gt;&lt;p&gt;Is this possible?&lt;/p&gt;&lt;p&gt;Seeing ASP.NET knows what control initiated the postback, and where it needs to go after the page load, this should be a peice of cake.... But I have searched and searched. Not luck.&lt;/p&gt;&lt;p&gt;&amp;nbsp;Any thoughts?&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>