<%@ Control Language="C#" %> <% // DataFade.ascx // Implementation of the DataFade AJAX Control. // Copyright (c) by Matthias Hertel, http://www.mathertel.de // This work is licensed under a BSD style license. See http://www.mathertel.de/License.aspx // ----- // 06.08.2006 created by Matthias Hertel %> <script runat="server"> protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (Page.Header == null) throw new Exception("The <head> element of this page is not marked with runat='server'."); // register the JavaScripts includes without need for a Form. if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), "CommonBehaviour")) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "CommonBehaviour", String.Empty); ((HtmlHead)Page.Header).Controls.Add(new LiteralControl("<script type='text/javascript' src='" + Page.ResolveUrl("~/controls/jcl.js") + "'><" + "/script>\n")); } // if if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "MyBehaviour")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyBehaviour", String.Empty); ((HtmlHead)Page.Header).Controls.Add(new LiteralControl("<script type='text/javascript' src='" + Page.ResolveUrl("Wuerfel.js") + "'><" + "/script>\n")); } // if } // OnPreRender </script> <div id="<%=this.ClientID %>" class="Wuerfel" unselectable="on">click</div> <script defer="defer" type="text/javascript"> jcl.LoadBehaviour("<%=this.ClientID %>", WuerfelBehaviour); </script>
This page is part of the http://www.mathertel.de/ web site.
For updates and discussions see http://ajaxaspects.blogspot.com/.