by todd on Apr 23, 2009 at 2:48 PM

Displaying modal content on websites has improved greatly with the usage of lightbox style modal popups.  Most users are familiar with showing images in a lightbox, but showing other types of content is a nice benefit.  Using jQuery and FancyBox allows for several types of content to be shown: Images, Text, Frames, etc.  One content type that has been problematic for many developers is PDF documents.  It would be very nice to show the PDF within the lightbox style popup, but non-HTML content can be an issue in modals.

A simple work-around is to create a handler page (called PressDetailsFile.aspx in this sample) that will display the PDF document within an iFrame and then load that page with FancyBox. You will want to set the frame size to the same size as your Fancybox less about 5 pixels.  This will keep scroll bars from showing on the modal.  The PDF document will scroll within Acrobat.

<iframe src="Docs/PDF-Document.pdf" width="695" height="595"></iframe>

The jQuery usage is shown below:

$(document).ready(function() {
    $(".fancyFrame").fancybox({'frameWidth' : 700, 'frameHeight': 600, 'overlayShow': true, 'hideOnContentClick': false});
});

<a class="fancyFrame" Title="Item Title" href="PressDetailsFile.aspx?File=PDF-Document.pdf">Link to Document</a>

This sample can easily be expanded and used within a dynamic listing of documents.

Showing a PDF Document with FancyBox


by Todd on Mar 24, 2009 at 2:36 PM

I recently had a website that needed the ability to rate multiple items on a page.  I had previously used the ASP.NET AJAX control toolkit available at http://www.asp.net and it included a rating control that worked perfectly for the project I was building.  Or did it?

jquery star rankingIt didn’t take long to set up the control and put together the Business logic and Data layer for the project.  The requirements were fairly simple.  Display items on the page and allow users to rate the items from 1 to 5 and only once within a specified time period.  The business layer had a configuration for the time span of voting and whenever a vote was cast, it would simply return a Boolean on whether the vote was saved or not.

During final testing of the rating section, I noticed a single instance of lag when rating one of the items.  Since the site was running locally, it caught my attention.  I opened Firebug and inspected the page.  Keep in mind this page was still clean – the page and master pages were blank with the exception of simple navigation links and the datalist of 4 or 5 items to rate.  Firebug reported the postback response at almost 12kb.  Since the datalist was within the update panel, that was not surprising.  Each item had some detail information and inline styles for testing.   However, even after final CSS streamlining, it was likely to have a decent amount of information returned with each vote, especially if we paged the listing at 12 or more items.  For a small website without a lot of traffic, this may be acceptable.  For most people using the internet at DSL and faster speeds, the vote would take less than a second.  However, if the site became busy, that traffic could add up quickly!

As any good developer should, I set off on a Google search to find information on streamlining the update panel and only returning the information concerning each vote.  It did not take long to find other complaints about the hefty update panels or the amount of work required to get granular control using ASP.NET AJAX panels and controls.  In fact, I kept coming back to the fact that it would be simpler to use “old school” AJAX approach and create my own JavaScript XML connection and parse the results.  I had used this approach in many instances prior to the release of Studio 2005 and AJAX support without issue.

I did one last Google search for a JavaScript rating sample to use as a framework since I decided to drop the AJAX toolkit control.  I immediately came across the jQuery Star Rating plugin.  It looked very promising AND it gave me a chance to use jQuery within an ASP.NET web site.  I had dabbled with jQuery, but had wanted to get more proficient before adding it to a current project.  Since there’s no time like the present,  I quickly downloaded the plugin, added a literal control in the datalist and kicked out 5 radio button items with a specific class.  In a short time, I had the plugin working and looking great!  At that point, jQuery offered a perfect solution for the AJAX.  A simple jQuery post to an ASP.NET page that used the same code I had already written was all that I needed.  I was able to return a message to the user for each vote and Firebug showed it at 20 BYTES!  A few style sheet additions later, I had a very nice rating system ready for action.

  

by Todd on Sep 1, 2008 at 11:25 PM
Filed in

Google announced via a comic book press release they will launch a new browser engine called Google Chrome. (See the comic here)

"On the surface, we designed a browser window that is streamlined and simple. To most people, it isn't the browser that matters. It's only a tool to run the important stuff -- the pages, sites and applications that make up the web. Like the classic Google homepage, Google Chrome is clean and fast. It gets out of your way and gets you where you want to go."

Google Chrome ImageSome of the benefits of Google Chrome include the ablility to prevent one tab from crashing another and provide improved protection from rogue sites. This means one web page won't interfer with the entire browser session. Instead of closing the browser, you'll simply have to close one tab associated with the troubled website. Google Chrome also intends to improve speed and responsiveness, as well as "a more powerful JavaScript engine, V8, to power the next generation of web applications that aren't even possible in today's browsers."

We will be taking a look at Google Chrome as soon as possible and add it to our list of testing platforms to ensure all websites we build function properly in this browser. 

Tags:

Widget RecentPosts not found.

Unable to cast object of type 'ASP.widgets_recentposts_widget_ascx' to type 'WidgetBase'.X

Widget Administration not found.

Unable to cast object of type 'ASP.widgets_administration_widget_ascx' to type 'WidgetBase'.X

Widget Search not found.

Unable to cast object of type 'ASP.widgets_search_widget_ascx' to type 'WidgetBase'.X

Widget TextBox not found.

Unable to cast object of type 'ASP.widgets_textbox_widget_ascx' to type 'WidgetBase'.X

900 S Shackleford Road · Suite 401 · Little Rock Arkansas 72211 · 501-975-1011