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!