ASP.Net nested web forms + nyromodal: Postbacks die after modal is closed
I have an ASP.Net web page that uses the master page template.
The page has an UpdatePanel with some basic AJAX functionality (changing the DropDownList and UpdatePanel value will be updated). This all works great.
I also have a link where the nyromodal Modal appears, inside the modal, another ASP.Net web form is loaded. Because I want this page to have its own functionality itself, not just a static page etc. specify "Create new" dialog. So it creates a new record, then when it closes, you are taken back to the main Record List page, and so on.
I am using the following jQuery code to initiate nyromodal calls. This code also includes various other tweaks and tweaks to make nyromodal more compatible with ASP.Net as this is about the 5th sequential incompatibility I ran into and decided between nyromodal and ASP.Net (Lesson: Avoid ASP.Net. Net)
$(document).ready(function(){
$(function(){
$('.modal').live('click', function(evt){
$(this).nyroModalManual({'blocker':'#aspnetForm',minWidth:640,minHeight:400,endShowContent:function(elt, settings) { $('input:text:first', elt.content).focus(); }});
evt.preventDefault();
});
});
});
This code works really well (thanks Brian) as it solves a couple more problems with ASP.Net and nyromodal working together. Its even a blocker use: the #aspnetForm bit that stops nyromodal from going outside the main ASP.Net callback form named aspnetForm, which is designed to solve an almost identical problem .
BUT..
The web page I load into my modal is also a .NET web form. So it also has its own built in aspnetForm postback of course. So when the modality comes up and I use FireBug to inspect the DOM structure, I actually have two ASP.Net forms (nested). And since nyromodal is essentially just a div (or multiple divs), the form tags are essentially nested.
So I think this is pulling on big things. This actually crashes IE7 completely (fatal exceptions). IE7 + FireFox: When I close the dialog, my main web form won't submit anymore. I think he was very confused by the two form tags that were there a moment ago.
It should be a really simple requirement to be able to open an ASP.Net webform as content for your modal use using nyromodal. I blame him on ASP.Net for being so lame and putting the required "form" tag on every page. If I were using PHP, I would not have experienced ANY of these problems I had today, but I am stuck using ASP.Bloat for production purposes.
Any thoughts or insights are greatly appreciated! :)
a source to share
I am actually the person who reported this issue. First, have you tried the ASP.NET nyroModal plugin that jimbobmcgee (on the same page that u is linked from) developed ? I haven't been there yet as I haven't taken the time to go through the contained documentation. If you do, let me know how I work for u.
This is actually the perfect timing ... Another alternative, which is that I'm in the midst of research, is using regular HTML pages instead of WebForms in the modal. So my intent is to wrap my server-side code in a webservice and use jQuery to call it and return a JSON response.
Forgive the accuracy of my explanation as I just started with web services and page methods so I am learning too much. Hence the reason why I am asking someone to post a simple "Hello World" example.
Hope it helps.
a source to share
If you put this at the top of the page. This allows the nyro modal to be modified for feedback.
<script type="text/javascript">
$(document).ready(function(){$.nyroModalSettings({
modal: true,minWidth: ###,minHeight: ###,
endRemove:function(){
document.location='pageYouWantToRefresh.aspx';
}
});});
</script>
just change document.location and it will go there when the window is closed.
a source to share