This is a migrated thread and some comments may be shown as answers.

WebUserControl, Multipage and Ajax

1 Answer 48 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 29 Dec 2011, 06:32 PM
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:
http://demos.telerik.com/aspnet-ajax/tabstrip/examples/clientside/clientsideapi/defaultcs.aspx

Problem:
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;
        }
    </script>
</telerik:RadCodeBlock>
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.
Chris

1 Answer, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 03 Jan 2012, 12:50 PM
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,
Kate
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
Tags
TabStrip
Asked by
Chris
Top achievements
Rank 1
Answers by
Kate
Telerik team
Share this question
or