Disabling buttons/lists/etc when executing ASP.NET AJAX request

Just drop it in your page before the </body> tag:

    <script language="javascript" type="text/javascript">
        var prm = Sys.WebForms.PageRequestManager.getInstance();

        prm.add_initializeRequest(InitializeRequest);
        prm.add_endRequest(EndRequest);

        var oldClass = "";
       
        function InitializeRequest(sender, args) {
            var postBackElement = $get(args._postBackElement.id);
            if (postBackElement != null) {
                postBackElement.disabled = true;
                oldClass = postBackElement.className;
                postBackElement.className = postBackElement.className + " disabled";
            }
        }
       
        function EndRequest(sender, args) {
            var sourceElement = $get(sender._postBackSettings.sourceElement.id);
            if (sourceElement != null) {
                sourceElement.disabled = false;
                sourceElement.className = oldClass;
            }
            oldClass = "";
        }
    </script>

And add this to your CSS (you may differentiate this among various tags like img.disabled for imagebuttons or input.disabled for textboxes etc.):

.disabled
{
    FILTER: alpha(opacity=70);
    BACKGROUND-COLOR: gray;
    opacity: 0.7
}

Just be carefull if you change the class of the element in question (that originated the ajax postback) to register a client script block to set oldClass to the new value as well, otherways it would be overwritten.

Streaming server and ASX

At one my clients occured the problem of all videos being played 3 times 3 times 3 times instead of just one.

After some investigation, it turned out, that for each request coming for a WMV file instead of an ASX file is returned. For example, for a request for http://stream/stream.wmv the following asx was generated:

<asx version="3.0">
  <title>Stream</title>
<entry>
    <title>www.stream.hu</title>
    <ref href="http://stream3/stream.wmv" />
    <author>Stream</author>
    <copyright>(c) 2008 stream</copyright>
  </entry><entry>
    <title>www.stream.hu</title>
    <ref href="http://stream1/stream.wmv" />
    <author>Stream</author>
    <copyright>(c) 2008 stream</copyright>
  </entry><entry>
    <title>www.stream.hu</title>
    <ref href="http://stream2/stream.wmv" />
    <author>Stream</author>
    <copyright>(c) 2008 stream</copyright>
  </entry>
</asx>

If you read the specification for the ASX file format, this should/may be rewritten as:

<ASX VERSION="3.0">
<TITLE>Stream</TITLE>
   <ENTRY>
   <TITLE>www.stream.hu</TITLE>
      <REF HREF="http://stream3/stream.wmv" />
      <REF HREF="http://stream1/stream.wmv" />
      <REF HREF="http://stream2/stream.wmv" />
      <AUTHOR>Stream</AUTHOR>
      <COPYRIGHT>(c) 2008 stream</COPYRIGHT>
   </ENTRY>
</ASX>

This would instead of playing the three items after each other just choose the first one, that responds in a timely fashion from the list. The day is saved, the roundrobin load balancing still works as it should, and nothing plays three times three times three times.