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

[Solved] Modal window with ajax loaded content

2 Answers 151 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.
Iulian
Top achievements
Rank 1
Iulian asked on 06 Jan 2011, 10:17 AM
Hi,
I have a grid for which I want to edit the selected row. For this, I am using a modal window whose content is a partial view loaded using ajax. The problem I have is that none of the view's ajax enabled controls is working. For example, clicking on a dropdownlist should display its dropdown, but it doesn't. Same goes for tab control, clicking on a tab doesn't select it. I know I'm doing something wrong but I can't figure out what.

view (just an excerpt, to exemplify ):
<div>
    <% Html.Telerik().DropDownList().Name("DropDown")
       .DataBinding(dataBinding => dataBinding.Ajax().Select("Home", "GetList")).Render(); %>
</div>

controller action:
public ActionResult OpenEditWindow(int id)
{
    // code to select object
    // ...
 
    return PartialView("EditWindow", new { /* model */ } );
}

ajax request (coming from Index.aspx):
$('#EditButton').click(function() {
    $.ajax({
        type: 'POST',
        url: '/Home/OpenEditWindow',
        data: { id: 1 },
        dataType: 'html',
        success: function(htmlData) {
           $('#EditWindow').data('tWindow').content(htmlData);
          $('#EditWindow').data('tWindow').center().open();
        }
    })
});

2 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 06 Jan 2011, 10:47 AM
Hello Iulian,

The JavaScript files required by the components are not registered automatically when you're loading partial views with Ajax. You need to register the scripts manually. Please see this help topic for detailed instructions - Using with partial views loaded via Ajax

Regards,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Iulian
Top achievements
Rank 1
answered on 06 Jan 2011, 03:33 PM
Thank you Tsvetomir, I only had to register the .js files and now it works :)
Tags
Window
Asked by
Iulian
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Iulian
Top achievements
Rank 1
Share this question
or