I need to load aspx page into jQuery UI’s modal dialog window.
I used following approach: load page content via ajax call into dialog’s div and show it:
$.get('Page.aspx', function(response){
$('#dialog').html(response);
$("#dialog").dialog('open');
});
but I’ve got very strange error (IE8) in line 137215738 (!): ‘theForm.elements.length’ – is null or not an object. JS debbuger says that source code is not available for such location. I have an assumption that this error happens because of multiple ‘form’ tags that appears on page after ajax call
I wonder, how can i fix this? Or maybe some other way of showing aspx page in modal dialog?
You cannot fully embed one ASPX page’s content within another for a couple of reasons:
<html>tags in a non-sensical way.You need to render
Page.aspxas a partail view, rather than including the entire payload of an ASPX page.I’m not 100% sure if you can do this in plain-old-asp.net without calling the
Renderfunction of individual controls, using the Response stream as the target.In ASP.NET-MVC, however, you can use a PartialView result.