Aspnet controls and ajax

Developer
Sep 24, 2010 at 11:33 AM

Anton,

I'm using a telerik:RadWindow control in a template - got code from a samples of yours :-)

It's working perfectly, but I have a small issue I cannot solve. The control is declared like this:

<xsl:text disable-output-escaping="yes"><![CDATA[
	<%@ Register
	   TagPrefix="telerik"
	   Namespace="Telerik.Web.UI"
	   Assembly="Telerik.Web.UI" %>
	]]></xsl:text>
<mdo:asp xmlns:asp="asp" xmlns:telerik="telerik">
	<telerik:RadWindow ID="wnd" runat="server">
		<ContentTemplate>
			<div id="popup" />
		</ContentTemplate>
	</telerik:RadWindow>
</mdo:asp>

The problem is the CDATA, which is necessary to let this declaration valid within the xslt, but that is shown on screen when I have an mdo:ajax call: that is after firing the mdo:ajax call (I have two select, the second loading depending on the first), I can see the declaration inline:

<select name="idRegione" onchange="{mdo:ajax()}">

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
... Rest of HTML ...

That declaration is not visibile before I call mdo:ajax.

I did some tests, and don't think the position of the control declaration within the template does matter, that is an mdo:ajax call does actually reload the entire module. Did you ever match a similar problem?

Coordinator
Sep 24, 2010 at 5:28 PM

First of all, XsltDb ajax is not compatible with ASP.NET controls. You have to use ASP.NET ajax instead. You can activate ASP.NET ajax for all instances of XsltDb by setting "Supports Partial Rendering?" for XsltDb View control (Host / ModuleDefinitions / XsltDb / ModuleControls / ViewXsltDb.ascx). Or you can manually create ScriptManager and other ASP.NET AJAX components in the particular module.

XsltDb AJAX is something different than ASP.NET AJAX and it is much faster that ASP.NET AJAX. So you must separate your ASP.NET controls from areas that are "AJAX-ed" via XsltDb AJAX. there are two ways of doing that:

  1. Using <noajax> tag.
  2. Putting ASP.NET controls in separate module

And one more tip: In current version you can remove telerik prefix declaration for Telerik.Web.UI and Telerik. Charting name spaces. they are added automatically when page is loaded.

noajax tag is not documented yet. All code inside <noajax> is not sent to the client if mdo:ajax is processed. so if you enclose your ASP.NET object in <noajax> you can avoid displaying ASP.NET tags after AJAX is occured. But remember that <noajax> content goes exactly above other content of module.

Simple sample:

<noajax>
  <script type="text/javascript">
    // this script will never be reloaded and re-executed when module is refreshed via mdo:ajax
  </script>
</noajax>

<div>
   <!-- this section is re-created each time ajax refresh is happened -->
</div>

Using noajax remember: XSL inside noajax is executed each time module refreshed but if it is page request execution - noajax results are included in output and are put on the top of other content. If it is AJAX request processing - noajax section is cut from output.

Developer
Sep 27, 2010 at 2:55 PM

Anton, 

the "noajax" trick solved my problem, great :-)

Is there something similar to simulate the use of different updatepanels? Say I have two areas which I want to update via ajax: as far as I know any mdo:ajax call will impact on all content (excluding what is in NOAJAX sections off course), or would it be possible to limit this within some area?

For example say you have a jquery ui tabs control that dynamically loads, via ajax calls, the content of its tabs: when a function to load a tab's content is called, only that tab should be updated - not the entire module. In a normal DNN module I use different updatepanels, with xsltdb how could I do?