Quite often, I develop web forms containing heavy elements, in particular large select tags, which can be a bit of a problem. All pages in ASP.NET are technically forms, but in this particular instance I’m talking primarily about ASP.NET MVC with it’s normal html layout.
If you remove just these select elements, the size of the form can often become 2-3 times smaller. In two recent projects, I’ve been trialling the following idea – “What if the page itself contains empty select elements only, but after the page has loaded, all these elements silently get populated via ajax requests?” The concept appears to be working well. It’s impossible to see any “flickering” on the page after it’s loaded, simply because the content of the select elements is invisible by default.
Here is the example of how this can be done in jquery:
$(document).ready(function() {
$("#sBank").load(SiteRoot() + "Details/InsertBanks", null, function() {
if ($("#bankName").val()) {
$("#sBank").val($("#bankName").val());
}
});
});
Let me know what you think
Related posts:
- Unique Arrays in PHP
- “Capitalise” jquery extension
- The easy way to clear floated elements
- ASP.NET selectors in jquery
- ASP.NET Button – prevent double clicks part 2
Tags: jquery




