Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can't "jump ahead" to the rendering because there aren't any conditionals in <code>ProcessRequestMain</code> to allow for it. The only option is to hack the event handlers of the relevant controls.</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { // DON'T DO THIS!! Years from now, some poor soul tasked with // debugging your code will tear their hair out, until they // discover the unholy magic you have conjured herein. Keep in mind // this is the 21st century and this person knows where you live. // // Seriously, just use the validation built in to ASP.NET. if ("true".Equals(Request.QueryString["disable_events"], StringComparison.OrdinalIgnoreCase)) { // disable *all* event handlers on button controls foreach (var b in this.GetControlDescendants().OfType&lt;Button&gt;()) { var eventList = (EventHandlerList) typeof (Control) .GetProperty("Events", BindingFlags.Instance | BindingFlags.NonPublic) .GetValue(b, null); typeof (EventHandlerList) .GetField("head", BindingFlags.Instance | BindingFlags.NonPublic) .SetValue(eventList, null); } } } </code></pre> <p>Utility extension method for completeness:</p> <pre><code>/// &lt;summary&gt; /// Performs a breadth-first traversal of a control's control tree. Unlike /// FindControl, this method does not descend into controls that have not /// called EnsureChildControls yet. /// &lt;/summary&gt; /// &lt;returns&gt;Enumerable of the visited controls.&lt;/returns&gt; public static IEnumerable&lt;Control&gt; GetControlDescendants(this Control parent) { // Don't force execution of EnsureChildControls if (!parent.HasControls()) yield break; foreach (Control child in parent.Controls) { yield return child; } foreach (Control child in parent.Controls) { foreach (var descendant in child.GetControlDescendants()) { yield return descendant; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload