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

[Solved] How to set content in the window with javascript?

2 Answers 154 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Patrik
Top achievements
Rank 1
Patrik asked on 20 Jul 2011, 04:34 PM
I have a window that looks like this:
@{Html.Telerik().Window()
        .Name("Window")
        .Title(ManageHelpers.Translate("communityhelpdesk", "communityPostsTitle", Model.EventId))
        .Modal(true)
        .Buttons(b => b.Close())
        .Content("<p style=\"text-align: left;\"><img src=\"/Content/Images/Site/ajax-loader.gif\" /></p>")     
        .Width(1000)
        .Height(700)
        .Visible(false)
        .Render();
}


Now when the user does something it needs to reload with the requested content, but first i need to clear the information and show the loading icon.

I tried something like this, but this doesn't work (same loading icon as in the construct above):

function showModal(windowName, path) {
    var window = $('#' + windowName).data('tWindow');
    window.element.innerHtml = '<p style="text-align: left;"><img src="/Content/Images/Site/ajax-loader.gif" /></p>';
    window.ajaxRequest(path);
    window.center();
    window.open();
}

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 21 Jul 2011, 06:21 AM
Hello Patrik,

window.element will return the component wrapper, which is not the DOM element that you need. Please use

$('.t-window-content', '#WindowID').html('new html content here');

All the best,
Dimo
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Patrik
Top achievements
Rank 1
answered on 21 Jul 2011, 09:28 AM
Worked like a charm, thanks!

I couldn't find this in the documentation for the Mvc Window.
Tags
Window
Asked by
Patrik
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Patrik
Top achievements
Rank 1
Share this question
or