Tuesday, June 26, 2007

Aspdotnetstorefront Menu

Some things are easier than you think they're going to be, and that just makes my whole day! So every single client we've had has requested the top categories go horizontally across the top in the menu instead of vertical submenus under Category, and to accomodate this, we've hard-coded the menus in menuData.xml in the skins directory.

What we lose here is the dynamic control of the menus for our clients, meaning they have to touch an xml file in addition to setting up the categories, and i don't know many product managers who speak xml.

So what I found was a curious line of code in the templatebase.cs file in app_code. Look at the Page_Load function and the section commented "// Find Categories menu top" and the line which starts with a call to AddEntityMenuXsl. See the final parameter being passed into that method is string.Empty. Well, when i look at AddEntityMenuXsl, I see that we have a piece of code that allows us to add a ROOT level element if the parameter length is greater than 0. So I just made my method call look like this:

AddEntityMenuXsl(doc, "Category", AppLogic.CategoryEntityHelper.m_TblMgr, mNode, 0, "1");

and VOILA! I now have a dynamic menu with the categories across the top! With just a little itty bitty code change. Some days programming is berry berry good to me :)

Thursday, June 21, 2007

Specified string is not in the form required for an e-mail address

If you have recently moved from the System.Web.Mail (.net 1.1) to System.Net.Mail (.net 2.0), you might get this error message when sending in a string of mail recipients, and when debugging, the emails look good to you! The reason is the delimiter. I cannot imagine what twist of fate movitivated the Microsoft Class gods to switch a standard on us, maybe it was just to keep us on our toes, but they did. We used to delimit our email addresses (multiple to's, cc's, bcc's, etc) with semi-colons (;) as we do in outlook, but that no longer works, now the class only accepts the comma (,) as the address delimiter. Go figure.

So, if you have a large established code base, and you want to upgrade your mail class, just one class that you use for ALL your applications, what do you do to minimize your rework? My advice is to use the string replace function and just replace every instance of semicolon with a comma. That will handle the old code passing in semicolons as well as the new code passing in commas. Then you have one place to make the update and you can leave your legacy code alone.

If you are NOT using a single mail handler class across your applications, then you're working too hard!

Wednesday, June 13, 2007

Best Joke I've heard this week

If you're not part of the solution, you're part of the precipitate...

It's such an inside joke, think back to high school chemistry. This is a t-shirt available at www.thinkgeek.com, which is my favorite website for truly geeky things, such as the t-shirt I got my husband, "I'm with Genius" and an arrow pointing up. If you need a break in your day, and little gadgets to proclaim your geekhood, check this site out.

Monday, June 11, 2007

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Fun error we get in aspdotnetstorefront all the time! It could happen when you recompile the website, or when you publish to a staging or live server. The easiest way to handle this is to open the task manager and kill the asp_net worker process. This is faster than an iisreset, which is the next step to take if killing the process does not remove that error.

Don't bother with what the error message says, it's just a hiccup when the app starts thinking about an exit strategy for the war in Iraq.

Friday, June 8, 2007

ADA Compliance

Americans with Disabilities Act (ADA) Compliance is now a scary term for high-volume eRetailers. It hasn't been decided in court, but Target has been sued in a class-action lawsuit for not making accomodations for disabled visitors.

The language of the Act is pretty vague and general, and those with bigger budgets are expected to make correspondingly more accomodations, and to muddle the muddy waters further, there's just no list to go by to say what is compliant and what is not.

There ARE however a couple of things that are just good practice anyway, the first of which using alt text for ALL images (except maybe corners on tabs and things like that). Sight-impaired visitors have devices that read the alt-text out loud so they can know what's on the screen in front of them. It's also a best practice for Search Engine Optimization, so just do it!

Another requirement from a recent client was to make the site keyboard navigable. This was a doozy. We had a pre-packaged component that came with aspdotnetstorefront, but it was a no-go for keyboard navigation. Our senior developer on the project, Tomas Vera found this nifty menu at http://www.milonic.com that you can tab into and use your arrow keys to navigate. This is a great find, IMO. Another tip for you, set your tabindex to 1 on your website logo so that if a user wants to tab through the page, they will always start at the top left. The only exception to this would be a search page where the user expects the focus to be in the search box so they can just begin typing.

Just one more disjointed rant from the trenches!

Thursday, May 17, 2007

Aspdotnetstorefront Menu

ASPDNSF uses a 3rd-party component for their navigation menus, Component Art. I've had some fun and exciting times customizing this menu. I would put styles, such as color and font, in the css classes TopMenuGroup and TopMenuItem, and the styles weren't sticking. Sooo frustrating! So using my IE DOM explorer, I highlighted the element (Find -> Select Element by Click) and examined the style, and found my target element to be wrapped in , which was elminating my css class assigned in the .

Here it is interesting to note that this menu is built on the fly, and you as a developer do not get to play with how this menu is created at runtime. I did some research on the NOBR tag and learned it was not css-friendly, but I took a leap of faith and added this to my stylesheet:

.TopMenuItem, .TopMenuItem NOBR, .TopMenuItemHover NOBR
{
background: #443A23;
color: #fff;
}

And voila! My css-styles were now applied.

I'm still struggling with the fact that the marriage between ASPDNSF and Component Arts is not flexible. If you decide to take your top categories horizontally across the top of the screen, you end up having to hard code your menu values in the menuData.xml file and you lose your tie to the category admin component. What this means is that if you change the name of the category, or add a new category, or make a category unpublished, these changes will not be reflected on the front end until you manually modify the xml data file. What a pain. If anyone has gotten around this little feature, I would give you a homemade chocolate chip cookie.

Tuesday, May 15, 2007

IE Developer Toolbar

If you are designing forward-facing web sites using the CSS-box model layout, an essential tool for how your model is behaving is the IE Dev toolbar (get it here: http://tinyurl.com/2ddezw). I also check my sites in Firefox which also has a handy tool for developers (get it here: http://tinyurl.com/2z4tvg). These tools are invaluable when you have to design pixel by pixel to make things perfect.

And because I've used it in my post, I might as well tell you about TinyUrl. My developer-in-arms Pablo showed me this site and I use it all the time. If you have a horribly long URL, especially the encrypted versions, and you want to send a link to your peeps (or to your mother), then use this page: http://www.tinyurl.com. We've found that even Microsoft is using this tool in their MSDN pages :)