Wednesday, June 29, 2011

UpdatePanel isn't working, ScriptManager seems to not be rendering?

Where to start... I was using RadAjaxPanel with a standard ListBox and AutoPostBack enabled.  After clicking the new ListItem, the event would not fire.  Turns out that the RadAjaxPanel I was using was out-of-date that I believe was targeting the .NET 2.0 Framwork.  This would be a good time to explore using the standard .NET 4.0 UpdatePanel.

I found several demos that worked on their own in a new 4.0 project.  However when adding the demo code to our existing project, it didn't work.   The project had been updated from 1.1, to 2.0 to now 4.0 and it might have  even been upgraded from 1.0 to 1.1 - it's been around a while now.

I noticed that the demo's rendered HTML had a few things different from our implimentation of the demo.  Where the ScriptManager was at, the demo had:

<script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('scriptMgr', 'form1', ['tupdatePnl','updatePnl'], [], [], 90, '');
//]]>
</script>

and a LOT more google searching, led me to checking over the Web.Config for proper entries:

Turns out I was missing this:

    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </controls>
    </pages>
and this had to be removed:
    <xhtmlConformance mode="Legacy"/>

Tuesday, June 28, 2011

View DOM Source

Often times the original View Source in a web browser is not sufficient for developers due to AJAX, jQuery, etc..  The developer tools in IE 8 (access by pressing F12) are pretty useful, but today I stumbled on View DOM Source.

Access it by View, Source, DOM (Page) - or press Ctrl+G