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

[Solved] How to dynamically read the content of a DIV?

1 Answer 108 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.
Max
Top achievements
Rank 1
Max asked on 29 Dec 2011, 05:53 PM
Hi all
I have a DIV section which is filled up with content via AJAX calls.
How can I use/call the method .LoadContentFrom to read the content inside my DIV and open a popup window?
Here is some code:
<a href="#" onclick="loadChartTop()">Load chart top</a>
<div id="resultChartTop"></div>
...
function loadChartTop(context) {
    $('#resultChartTop').load('@Url.Action("_ChartTop", "Home")');
}
@(Html.Telerik().Window()
        .Name("WindowTopGraph")
        .Visible(false)
        .Scrollable(true)
        .Title("Top Graph")
        .Draggable(true)
        .Resizable(resizing => resizing
            .Enabled(true)
            .MinHeight(250)
            .MinWidth(250)
            .MaxHeight(1500)
            .MaxWidth(1500)
        )
        .Modal(false)
        .Buttons(b => b.Maximize().Close())
        .LoadContentFrom(?????????????????)
        .Width(1200)
        .Height(400)
)
Thank you

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 30 Dec 2011, 09:50 AM
Hello Max,

Basically LoadContentFrom method is used when you want your Window to load content from e specified action. In your case instead of loading the content from an HTML element you can load it directly from the controller: LoadContentFrom("_ChartTop","Home").

If you still want to set the value on the client side you can use the client API of the Window. This way you have two options:
  • Use the content method and set the value:
    $('#WindowTopGraph').data('tWindow').content($('#resultChartTop').html()); 
  • Or you can use the ajaxRequest method:
    $('#WindowTopGraph').data('tWindow').ajaxRequest('/Home/_ChartTop');


Greetings,
Petur Subev
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Window
Asked by
Max
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or