Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > Window > How to dynamically read the content of a DIV?

Not answered How to dynamically read the content of a DIV?

Feed from this thread
  • Max avatar

    Posted on Dec 29, 2011 (permalink)

    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

    Reply

  • Petur Subev Petur Subev admin's avatar

    Posted on Dec 30, 2011 (permalink)

    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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > Window > How to dynamically read the content of a DIV?
Related resources for "How to dynamically read the content of a DIV?"

ASP.NET MVC Window Features  |  Documentation  |  Demos  |  Telerik TV ]