This project is read-only.

Ajax only working partially

Topics: Developer Forum, Project Management Forum, User Forum
Apr 9, 2009 at 4:02 PM
 I created a small test page in an existing N2 project and that seems to work correctly:

<asp:UpdatePanel ID="UpdatePanelAjax" runat="server" UpdateMode="Conditional">
        <ContentTemplate>     
           <asp:Literal id="ajaxfield" runat="server"></asp:Literal>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ButtonUpdateGallery" EventName="Click" />
        </Triggers>
 </asp:UpdatePanel>

However, I'm using IIS7 and I referenced the "Templates" folder as a virtual directory in my current project. This is because I am making changes to the Templates folder that I want to use in other projects as well.
Anyway. The ImageGallery from the templates folder is working fine. I added a filter with tags but it is only working as long as I'm not using ajax. Could it have something to with it being in a virtual directory?

When I click the UpdateGallery button the event doesn't even fire. When I remove the updatepanel from the page everything works.

<asp:UpdatePanel ID="UpdatePanelAjax" runat="server" UpdateMode="Conditional">
        <ContentTemplate>            
           <p>Dit is WEL ajax stuff.</p>
           <asp:Literal runat="server" ID="labelke"></asp:Literal>
           
           <div id="thumbnails">
              <asp:Repeater ID="ItemRepeater" runat="server">
                <ItemTemplate>
                    <a id='t<%# Eval("ID") %>' href='<%# Eval("ResizedImageUrl") %>' class="thumbnail">
                        <img alt='<%# Eval("Title") %>' src='<%# Eval("ThumbnailImageUrl") %>' />
                    </a>
                    <div class="text">
                        <h2><%# Eval("Title") %></h2>
                        <%# Eval("Text") %>
                    </div>
                </ItemTemplate>
            </asp:Repeater>
            </div>
            <div id="preview">
        
            </div>    
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ButtonUpdateGallery" EventName="Click" />
        </Triggers>
</asp:UpdatePanel>

The gallery part is rendered as folows:
<div id="ctl00_PageWrapper_ContentAndSidebar_UpdatePanelAjax">
   <div id="thumbnails">
   </div>

<div id="preview"> </div> </div>



Any ideas?
Apr 16, 2009 at 10:11 PM
Are you saying it works if you're not in a virtual directory?
Apr 16, 2009 at 10:15 PM
Apparently yes. Did anybody try this as well?
Apr 18, 2009 at 10:04 PM
With some configuration fiddling it works for me. Do you have this in configuration/system.webserver/handlers?

            <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

If you run fiddler or firebug can you see any odd requests?
Apr 21, 2009 at 8:41 AM
Apparently it does work in a virtual directory.
It works with newitem e.g. but not with the image gallery.
Did you place the entire gallery in an updatepanel?

With firebug I can see the response contains the thumbnails etc. but somehow it isn't showing in the browser.
Maybe the javascript from the gallery has something to do with it?
Perhaps you could send me the exact code you used with the gallery if you still have it?

I have the exact same script resource btw.
Apr 21, 2009 at 5:57 PM
Hmm, the image gallery. Could it be an issue with javascript initialization? The gallery in the templates project does some manipulation on the outputted image list.