AJAX AdRotator issue

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 years ago
Hi All, I have a customer who wants and AdRotator and I decided to do it in as an ASPX module,

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
    <asp:Timer ID="Timer1" Interval="3000" runat="server">
    </asp:Timer>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" >
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />      
    </Triggers>
    <ContentTemplate>      
            <asp:AdRotator ID="AdRotator2" runat="server" AlternateTextField="Specials"
            AdvertisementFile="~/Advertising/Advertisments.xml" Height="160" Width="160" />
    </ContentTemplate>
    </asp:UpdatePanel>

It all seems so simple, I then added my module to the two-column Master and it works just fine. But then when I click on a link to a product I get this:



Server Error in '/' Application.
Only one instance of a ScriptManager can be added to the page.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Only one instance of a ScriptManager can be added to the page.

Source Error:

Line 50:
Line 51:                 child = base.LoadControl(productTemplate.TemplatePath);
Line 52:                 this.ProductPlaceHolder.Controls.Add(child);
Line 53:             }
Line 54:         }


:) I just feel I'm missing something obvious here, what am I doing wrong?

Regards

Mike

ps. I'm going to do a bit more work in this, once I get it functioning, I'd like to do a 'best sellers' rotator module. Then I post it back for everyone to use.
14 years ago
Hi,

There're script managers conflict. Look at the product templates "Templates\Products\VariantsInGrid.ascx" and "Templates\Products\OneVariant.ascx" they are both requiring an AjaxToolkit ScriptManager. You should handle it. And keep in the memory that only one script manager can exists on the page and AjaxToolkit ScriptManager increase the page size.
14 years ago
Thanks for you advice. I kind of knew what the problem was but I was unsure what the best solution was.

This is what I've done:
/*
Script Manager Commented Out:
Templates\Products\VariantsInGrid.ascx
Templates\Products\OneVariant.ascx

Script Manager Added, with same format:
\MasterPages\TwoColumn.Master

New AddRotator Component Added to TwoColumn.Master (in sidebar)
New Module \Modules\AdRotator.ascx

New Directory \Advertising with xml and images
*/

As I'm unsure exactly what my client wants in the add rotator I thought I'd go with the XML option. I had thought about just doing the best sellers with a datasource, but not yet.

I know I've enabled AJAX everywhere, but the rotator is in the sidebar, so it is almost everywhere.

This is my first try at modifying a large ASP .Net Application so any advice is useful to me.

I didn't go with flash or javascript as I felt this was less maintainable, for me at least.

Thanks for your help again.

Mike
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.