RadAjax to update Codeblock?

2 posts, 0 answers
  1. Seth
    Seth avatar
    2 posts
    Member since:
    Sep 2011

    Posted 30 Dec 2011 Link to this post

    I have a .NET page that has a RadRotator on it, displaying a series of images.  I also have a "Refresh" button that, when pressed, uses a RadAjaxManager to look for more images to display, and if found, adds them to the RadRotator.  This all works beautifully.

    However, I have a second component that is causing issues.  My RadRotator has a "Previous" and "Next" button that I control from code.  When these buttons are pressed they trigger the RadRotator to rotate, and then display a brief text explanation of the current image elsewhere on the page.  Both of these actions are achieved through Javascript: the rotator using the Client-Side API, and the text using an .innerHtml replace on an asp:Label.  The actual text comes from a Javascript array that I set the contents of using a <%= %> code block on page load.

    Here's the problem: I can't get RadAjaxManager to update the code block so that the javascript array contains an updated list of text explanations at the same time that more images are bound to the RadRotator.

    Possible Solutions:
    1.  Find some way to get RadAjaxManager to re-evaluate a block of javascript code containing an ASP.NET code block (Preferred)
    2.  Move the array of text explanations out of javascript and into some variable in the code-behind, then trigger a partial callback ever time the Previous/Next buttons are clicked to access it (Not preferable, because the Javascript solutions never has to contact the server)

    I tried setting the RadAjaxManager to target the RadCodeBlock that my Javascript is contained in to see if that would work, no luck with that.

    Any insight is appreciated, and have a happy New Year!
  2. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 03 Jan 2012 Link to this post

    Hello,

    In order to implement the desired functionality, I suggest that you use the approach from the Executing Custom Javascript Code after AJAX Update help topic.
    With it, you can update the desired array dynamically.

    I hope this helps.

    Kind regards,
    Mira
    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