[RESOLVED]Loading one view into another

I have a view that displays search criteria and a results grid on the top half of a page. This works just fine. There is a jQuery ready function which hides the bottom half of the page.

$(document).ready(function () {

    model.Init(); //Inits and populates the drops downs, etc.

    $("#MoreData").hide(); //Div tag to hold the detail information

});

When I do my search, the results grid fills with the records found. I click on a link column which then executes this code

function MoreDataDisplay(ID) {
    $(‘#MoreData’).load(‘/PL/Index/’ + ID);
    $("#MoreData").show();
};

The problem is that when I do this, the document.load event of the main page fires. I only want the $(document).ready of the /PL/Index view to fire. How to I make this happen?

Thanks

Carl

Hi Carl,

You can not load one view inside another view.

Thats where we have concept of PartialView. Convert your Grid’s View to Partial View. Make AJAX call to load data and then bind to grid and display the partial view.

It will work fine. Please let me know if you want me to elaborate any step.

Leave a Reply