WebUserControl, Multipage and Ajax

2 posts, 0 answers
  1. Chris
    Chris avatar
    29 posts
    Member since:
    Mar 2009

    Posted 29 Dec 2011 Link to this post

    Returning again to the fount of wisdom,

    I would like to switch between pageviews on a multipage via client click of a button using a drop down box as in demo example:

    1. the multipage is on a user control loaded in as template for radgrid based on various page events
    2. I only want the tiny multipage on one small part of the newly loaded user control to change via ajax
    3. I have an "exact copy" of code from the example, placed in a RadCodeBlock at beginning of web user ascx page, and when the button is pressed, it cannot find the function... so somehow it is not loaded "in time" or whatever.

    I tried putting the function in the underlying aspx page, but it needs to reference controls on the dynamically loaded user web form, so that seems to be a no go.

    Just some code snippets:
    From the top of the ascx control:
    <telerik:RadCodeBlock ID="RepeatCode"  runat="server">
        <script type="text/javascript">
            function SelectRepeatViewEdit() {
                var RepMultiPage = $find("<%= rmpRepeats.ClientID %>");
                var Index = parseInt($get("<%=RCBRepeat.ClientID %>").value);
                if (Index == "once") RepMultiPage.get_pageViews().getPageView(0).set_selected(true);
                if (Index == "daily") RepMultiPage.get_pageViews().getPageView(4).set_selected(true);
                if (Index == "weekly") RepMultiPage.get_pageViews().getPageView(3).set_selected(true);
                if (Index == "monthly") RepMultiPage.get_pageViews().getPageView(2).set_selected(true);
                if (Index == "yearly") RepMultiPage.get_pageViews().getPageView(1).set_selected(true);
                return false;
    The button is trivial:
    <asp:Button ID="btnSwitch" Text="Switch" OnClientClick="SelectRepeatViewEdit" runat="server" />
    And when I click the button I get a "function not found" error.

    It clearly is a problem with the function load somehow...

    I'd appreciate any help... I'm sure it's probably obvious.
  2. Kate
    Kate avatar
    1898 posts

    Posted 03 Jan 2012 Link to this post

    Hello Chris,

    From the code snippet it seems that you attach the event handler correctly. However, having the information provided I can not tell for sure what is causing the error that you get since you use user control that you ajaxify. Therefore I would suggest that you open a support ticket and send us a simplified runnable project that we could test locally and help you out with a suitable solution.

    All the best,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top