JQuery blockUI and ASP.Net?

Well im using jQuery and blockUI in asp.net i love jquery and blockUI but i found a problem when displaying a panel with a asp.net button in them the actual button is moved out of the form tag, so when you click the button nothing happens..

is there any way to configure blockUI to place its content tags last in the forms tag instead in the body tag!

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Now im not 100% sure this is the best solution but i did go into the jquery.blockUI.js and replaced a few lines..

Replace this line

var layers = [lyr1, lyr2, lyr3], $par = full ? $('body') : $(el);

with

var layers = [lyr1, lyr2, lyr3], $par = full ? $('form') : $(el);

Replace this line

$('html,body').css('height', '100%');

with

$('html,body,form').css('height', '100%');

Replace this line

els = $('body').children().filter('.blockUI').add('body > .blockUI');

with

els = $('form').children().filter('.blockUI').add('body > form > .blockUI');

and it seems to be working so far haven’t tested more than one browser yet!!

Solution 2

If I understand correctly, you’re looking to block just the form when a button is clicked outside the form. If that’s the case BlockUI supports element level blocking like this:

$('#blockButton').click(function() { 
   $('form').block({ message: null }); 
}); 

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply