Archive

Archive for the ‘AJAX’ Category

Bubbling up Methods in Composite Controls

A while back, I wrote a couple of articles (here and here) regarding encapsulating the ModalPopupExtender into a spiffy little template control that you could toss onto a page.  It’s worked GREAT over the past few months, however, I hit a snag today.

I needed to call the base ModalPopupExtender’s .Show() method from code behind; however, I hadn’t bubbled that up to the Composite Control.

At first, I expected to simply add a private instance of the MPE (which is assigned to when the control is built) and then add a method to my composite control that calls the .Show() method.

private ModalPopupExtender _control;

public void Show()

{

       _control.Show();

}

That sounds good, but it never fired and the _control field was always null (even though I could step through and it was assigned).

What it needed was a little reminder—a reminder to EnsureChildControls existed before trying to call Show().  Now, a quick update to the code:

public void Show()

{

       this.EnsureChildControls();

       _control.Show();

}

Now I can call the Show() method of the Composite Control and it works like a charm!  Here’s an example (for what I’m working with at the moment) of dynamically iterating through an IDictionary and returning the values in a Modal Popup.

ASPX:

<tiredstudent:ModalPopupTemplate HeaderText=”ERC” runat=”server”

        ID=”PopupDialogBox” DefaultStyle=”YUI” TargetControlId=”fakeButton” />

<asp:Button ID=”fakeButton” runat=”server” style=”display: none” />

Code-behind:

foreach (var entry in results)

{

       sb.AppendLine(string.Format(“<p>{0} – {1}</p>”,

                     entry.Key, entry.Value));

}

 

PopupDialogBox.BodyText = sb.ToString();

 

PopupDialogBox.Show();

 

Spring Break, oh how I love thee.

March 14, 2008 Comments off

The beach.Spring Break is great—especially when you work somewhere where it’s mandatory and paid

This is the first year in… well, ever, that I won’t have to attend college classes during my spring break holiday and can take the time to relax, catch up on projects I’ve been putting off, and sleep later than “almost going to be late” 6:00 AM.

Over the next week, I’m going to attempt to:

  • Catch up on all the new MVC bits from Release 2.  I really missed out being unconscious for a week with the flu and haven’t had time this week to dig in.
  • Now that Silverlight 2 is out, actually CARE about it.  Silverlight 1.0 was “neat,” but encapsulating videos into little boxes didn’t really appeal to me.  Full UI development does.
  • Build a desk, or a table, or something.  I’ve (well, my dad and I) had plans to build a new computer desk, recessed lighting, and shelving into my office area.  He’s been busy, I’ve been busy—it just hasn’t gotten done started.  There will be power tool usage, I swear it.  *Tim the Toolman laugh goes here*
  • WebGallery2 updates. I have made a few cosmetic and code changes to WebGallery2 to address performance issues and I need to get those changes tidied up and posted.

All in all, I honestly plan to spend as little time doing “work” as I can next week and just relax.  Of course, as fate may have it, it’s been sunny and in the 70’s all this week and is supposed to rain and be in the 40’s and 50’s all next week.  *sigh*

(Oh, and no, no beach for me—Kansas is about as landlocked as you could possibly get.)

 

IE 8.0 – First Impressions and Rendering

Unfortunately, I’m at home nursing the flu rather than living it up in Vegas at MIX08 so I’ve had to experience the fun vicariously through the thousands of blog posts, twitters, and videos of nearly every second of the event.

A big kick off revolved around the first Beta release of Internet Explorer 8.  Being adventuerous and well, not having anything else to do, I downloaded the x64 Vista version and have been hitting various web sites that I frequent to see how things look.

The IE Interface

Overall, IE 8 currently looks a LOT like IE7.  In fact, it takes a bit of hunting to find any differences what-so-ever.

The new “Favorites Bar” (or was that old) seems to be built to hold the new WebSlices, which I haven’t quite grasped yet (I don’t use eBay, sorry).

The Phishing Filter has been renamed the “Safety Filter”, which was immediately turned off.  I’m assuming Phishing was too difficult to explain (which is OK).  The concept is cool, I’m just not sure I want Microsoft being the “safe site” police.

Beyond that, I haven’t seen any other “changes”.  Let’s hope the real excitement is in the rendering.

Rendering

The tout of IE8 is it’s successful passing of Acid2, a standards-based rendering assessment.  Sadly, this is just in time for Acid3, which it not only doesn’t pass (nothing passes right now), but it does worse than most other “current” browsers only scoring a 17/100.

So, what about real sites?

Here are a few of the more common sites I visit and the results:

iGoogle – Renders OK, albeit VERY slowly.  Accuweather.com and del.icio.us web parts require mousing over the empty boxes to display their contents.  There is also a bunch of odd spacing at the top of the Gmail web part.

GmailRenders OK, very fast.  I couldn’t find any issue with Gmail at all.

Microsoft Exchange 2003 OWAWorks great, very fast. 

Microsoft SharePoint 2003 (SPS)Works very well.  Renders extremely fast from page to page.  Mouse overs, context menus, etc. seem to work even better than in IE7.  Hah.

Microsoft SharePoint 2007 (MOSS) Works.  Still requires “accepting” the “Name ActiveX Control”, which is REALLY annoying, but the site renders just fine.  Also renders a bit slow, but that’s just MOSS2007. :(

Weather.comWorks. A few positioning snafus, but everything is functional.  See image below.

Linkshell Fourms (built on VBulletin 3.6.8) – Works great.  The PHP-based forums work like a champ for my FFXI linkshell.  Thankfully!

Virtual Server 2005 R2’s Control PanelDoes not work.  Unfortunately, none of the menus work.  You cannot create/update/add anything or view the status of a running VM.  I can bounce back to IE7 emulation mode and it works OK.

MSDN Subscriber DownloadsSorta works.  I’m assuming the new version of this site will resolve these issues.  So far, the site “works”, but renders a bit funny when you move the frame bars around.

IE8 - FFXIAH

FFXI Auction HouseDoes not work.  The side navigation bar is covered up and inaccessible.  Without that, it’s almost impossible to browse through the site (searching for EVERYTHING gets a bit tedious). See image to the right.

Twitter.com – Sorta sometimes works.  The functionality of the site is there, but the background and themes to the site are a bit haywire.  And updates aren’t being processed without a logout/login.  Ehh, odd.

WordPress – Does not work.  For some reason, the wp-admin console simply blanks the page out.  There’s a brief flash of it rendering, and then poof, just white.  I can View Source and see the code, refresh and see the flash, but haven’t been able to fix this one without dropping back to IE7 mode.

My Blog (Freshy Theme)Sorta works. Well, this blog doesn’t render right either.  The Search bar at the top right of the screen is covered up and missing the [Search] button.  The right-hand bar no longer trails to the end of the page, but stops at the end of the content (assuming the height:100% failure), The main body footer is now the footer to the right-hand bar.  There are a few other z-index issues here and there, but those can be fixed (I’m assuming).

My Photo Site Does not work.  Hmm, sucks.  Unfortunately, the menus doesn’t work.  Well, let me reword that, they work, but if you try to move from the Parent Menu to a Child Menu item, the menu disappears.  I’m assuming it’s a spacing issue for the mouse overs, but I’m not sure.  Ugh.

Random sites – I noticed most sites that I authenticated to, the hash out for the password turned up as an invalid character.  See below.

Things I Wish It Had

NoScript.  I really like FireFox’s NoScript plug in—especially with all the shakeup and paranoia regarding compromised accounts in FFXI.  I wish IE had something similar built directly into the browser.

Built-in support for social bookmarking.  Does anyone use Favorites or Bookmarks anymore?  I totally rely on del.icio.us and would LOVE to see better support for that in IE8.  I don’t want an annoying button that was put out by Yahoo, I want to open an Explorer Panel (like my Favorites) and see the heirarchy of my tags.

Conclusions

Well, for Beta 1, it’s not half bad.  It starts up instantly, looks clean, and appears to integrate into Windows Vista just fine.  If a few of the odd rendering snafus can be addressed (either by releasing WHY it doesn’t work or tweaks to the rendering engine in IE), I look forward to the next release.

WebGallery 2.0 #5 – CSS Friendly and W3C Compliant

In the fifth, and final, segment on the WebGallery 2.0 project, I wanted to touch on the CSS Friendly Adapters and work that went into creating a fully W3C compliant project.

In previous posts, we’ve discussed:

#1 – Introduction
#2 – HttpHandler and LINQ Data Model
#3 – Building the Galleries
#4 – Adding Admin Tools

NOTE: Code downloads are available on the Introduction post.

Read more…

WebGallery 2.0 – #4 – Adding Admin Tools

February 25, 2008 12 comments

So far, we’ve discussed:

  1. Creating the basic data model for the WebGallery.
  2. Changes to the HttpHandler to increase speed and efficiency.
  3. Building and viewing the individual galleries–created using clean, simple HTML code.

Our galleries are now visible; however, we need a few administration tools to handle changes, such as updating the title and description or fixing a broken thumbnail (since they’re pre-generated now). 

#1 – Introduction
#2 – HttpHandler and LINQ Data Model
#3 – Building the Galleries

NOTE: Code downloads are available on the Introduction post.

This post will cover the topic of using the ModalPopupExtender to manage files once their added into the galleries.

Read more…

WebGallery 2.0 #3 – Building the Galleries

February 25, 2008 2 comments

In our last two posts, we’ve discussed the underlying data model and how LINQ and the HttpHandler wraps everything up to display our photos. 

#1 – Introduction
#2 – HttpHandler and LINQ Data Model

NOTE: Code downloads are available on the Introduction post.

This post will cover how the galleries use those data components and controls such as the Data Pager and ListView to build fully XHTML compliant code.

Read more…

WebGallery 2.0 – Introduction

February 19, 2008 4 comments

Over a year ago, I started creating the original “Photo Gallery,” which became the blueprint for my online photo and file repository.  I created the site because commercial solutions, like Flickr and SkyDrive, couldn’t provide me with exact URLs of both thumbnailed and full-size objects.  Google’s Picasa got close, but still required using their interface—which REALLY annoyed me if I wanted to post up photos for the blog.

With a year of experience behind me, and seeing what I liked/disliked about how WebStorage (its eventual name) worked, I set out to create version 2.0.

WebStorage2 FrontPage

Download Code: UPDATED 3 march 2008: build 38

Changes in this version:

  • Built on .NET 3.5.
  • Fully XHTML 1.1 compliant.
  • Compatible (mostly) and tested with with FireFox (2, 3pr), IE (6, 7), Opera (9.5), and Safari (3.0.4).
  • Removed Enterprise Library dependencies in favor of LINQ-to-SQL.
  • Resolution of file handing “issues” in v1.0.
  • Implementation of ASP.NET AJAX to speed up gallery rendering.
  • Added “paging” to the galleries.
  • Removed ASP.NET user controls in favor of cleaner ListViews.
  • Added caching to the WebStorageHandler.
  • Added Deflate and GZip HTTP Compression to the .aspx and .ashx pages.
  • Reengineered thumbnail managed (pre-fab’ed now) to speed up load times. (Thanks for the idea, Michael!)
  • and more!

Over the next few blog posts, I’m going to touch on each of the changes (noted above) and the reasoning behind them; however, I wanted to get the code out there.

Project LayoutProject Layout

The project’s laid out in a simply hierarchy—a folder per respective “area,” including the LINQ-to-SQL models.  I build the project in such a way to, I hope, easily move into the MVC frameworkThe additional App_Browsers directory is used by our CSS Friendly adapters.

This project is based on ASP.NET 3.5 (without the 3.6 extensions) and a couple of additional libraries:

I also used Visual Studio 2008’s new web tests (seen in the screenshot) to complete load testing and tidy up code.  I haven’t included that in the source code, but I plan to do a post on the features and results—it’s a very slick system.

Data Model

With full LINQ-to-SQL support, I opted for LINQ as a solution rather than the Enterprise Library.  LINQ encapsulates the SQL logic to keep our code secure, the data context object is a partial class—allowing us to custom code methods and properties into our models, and it just “works.”  If you haven’t noticed from other posts of mine, I really like LINQ as an ORM solution—especially now that it’s built into the environment and fully supported by the framework.

The model itself is quite simple.  Three tables control a majority of the functionality for the application.

The WebFile table
The WebFile table contains the actual objects for our WebStorage gallery.  ObjectBody and ObjectThumbnail are image columns containing the binary information stored for our objects.  The rest of the columns are attributes providing either end-user information (such as Description) or rendering information (such as ObjectType). 

A change from the previous data model is that thumbnails are stored along with the web files and are not “automagically” generated—saving both computation time on the server and speeding up rendering for the client.

For our two image fields, I’ve also enabled “lazy loading” or “delay loading”—an attribute that only returns these fields if they are explicitly used within the code and only once per query to save bandwidth.

The ContentType table
The ContentType table manages the MIME types, their thumbnails, and matching object types.  This table is used to render icons for PDFs, RARs, ZIPs, and other file types as well as generic icons for photos that do not have thumbnails.

The Gallery table
The Gallery table contains the keys, names, and allowed roles for each gallery.  The roles match up to membership roles provided by ASP.NET’s Configuration.

Next…

In the next post, I’ll discuss what went into the LINQ-to-SQL queries and how the use of the DataContext’s partial classes sped up development.  I’ll also discuss how the ImageHandler has been updated to match these data changes.

Edit: Updated to fix the fonts… I should know better than to create it in Word and then just copy/paste. :(

Follow

Get every new post delivered to your Inbox.