Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rasmus Hajslund 2 posts 22 karma points
    Oct 21, 2009 @ 15:57
    Rasmus Hajslund
    0

    Using AJAX in a UserControl for Umbraco Backoffice.

    Hi.

    I hope someone can help me with this one, it will give me the last "touch" on the project! :-)

     

    I have been building a user control so that i can add it to umbraco backoffice.

    The user control itself is working perfectly! It reads an excel file and adds new nodes based on the information you pick from the excel file.

    If you are adding a lot of nodes, it will offcurse take some time. Therefore i thought it would be a nice idea to build some sort of AJAX update Panel to inform the user of the progress, or at least to ask the user to wait until the task was done.

    The problem is that i can't get the most basic ajax update panel + timer to work. Im simply not getting the "timer event" which does the postback.

    Have tried to read a bit about AJAX, Threading and Timers, but im stuck.

    If i build a normal VS2008 project like this it works fine:

    <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
            </Triggers>
            <ContentTemplate>
                <asp:Label ID="Label1" runat="server" Text="UpdatePanel1 not refreshed yet."></asp:Label>
            </ContentTemplate>
        </asp:UpdatePanel>

    protected void Timer1_Tick(object sender, EventArgs e)
        {
            Label1.Text = "UpdatePanel1 refreshed at: " +
              DateTime.Now.ToLongTimeString();
            Label2.Text = "UpdatePanel2 refreshed at: " +
              DateTime.Now.ToLongTimeString();
        }

    If i try to copy the code to my usercontrol in umbraco, it's not doing anything! It's like the timer events are not fired, and the Timer1_Tick method is not called.

    My gues was at first it had something to do with the scriptmanager that is already included somewhere in an umbraco file. But i tried to delete the statement (and got offcurse an error so i could see that i had deleted the right statement), moved the scriptmanager to my own custom userControl code, but no difference.

    I have created my own Umbraco DataType, used the RenderControl: Umbraco UserControl Wrapper, and then added my own UserControl, wich is extended from the umbraco EditorControls. (Which by the way was really simpel to create...)

    So anyone have any ideas at all?

  • Rasmus Hajslund 2 posts 22 karma points
    Oct 21, 2009 @ 16:25
    Rasmus Hajslund
    0

    Have tried to install another AJAX toolkit too, by following this guide:

    http://our.umbraco.org/projects/ajaxcontroltoolkit-v3x-for-umbraco

     

Please Sign in or register to post replies

Write your reply to:

Draft