Links
Activity
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Blogroll
Archive
Categories
Search
Admin Login
Sign In

Ok, so this isn't so much "Smooth" in the sense that it's a really slick piece of code.  Rather it's "Smooth" because it took me way to long too figure it out and I thought that I better write it down somewhere that google has a chance of indexing it.  That way a month from now when I may have forgotten this, I'll be able to look it up. 

I'm working on this project where I show users an image and they can perform some zoom in type action where they click on the image and drag a rectangle, or they click on a bunch of points to draw lines allowing them to draw their own shape.  This is basically all accomplished with javascript.  Good.  Not hard to figure out.  When they are done drawing their shape, I am clicking on a button in the background (by using javascript) to force a postback so that I can call some web service in the code behind and reload the image.  Note that this isn't a full Page postback, since I'm using an anthem:button.

Ok, so all is well, I get the new image url, I load it up.  Done!  Not quite.  Because in my case, I'm doing some fancy fade in from a placeholder image that lets the user know that something is going on.  Ok, so I need to get back to running some javascript.  Stick it in the window.onload event.  Yeah.....no.  Not so much.  This is where anthem causes a problem because the page isn't actually reloading.  Just my image....which did I mention is an anthem:image?  So the obvious solution now is to put my javascript method call in the image's onload event.  Sounds like a good idea, right?  Well it is, but the only tricky part is, how do you do it?

This doesn't work:

<anthem:image onload="FancyFadeIn()"> </anthem:image>

That's because an anthem:image doesn't play the onload game that way.  BUT if you really know what's going on, you'll know that when everything is said and done that <anthem:image> ends up as an <img> which does have an onload event.  To add that attribute using the Language of the Gods VB.NET, you do something like this:

Me.mapImage.Attributes.Add("onload", "FancyFadeIn()")

Now when the image reloads, the fade in javascript is called and everything is right with the world.

Friday, August 18, 2006 5:45:23 AM (Pacific Standard Time, UTC-08:00) | Comments [0] |  |  | #

This is one of those stupid things.  Something where I’m trying to do something and it’s just not working.  Then when I figure out how to do it, I get that feeling like “I should have known how to do this”.  Many times that statement is modified to be “I only program freaking computers for a living, you would think that I would know how to do this”. 

Today I was trying to put a link into a OneNote page.  Simple enough, right?  You would think so.  The only problem was that my link had a few spaces in it \\SomeFancyServer\Applications Teams\Dev Team\Support.  Now if I was adding this link to something like Word, I would click on the Insert/Hyperlink menu item because I know that links and spaces in the address don’t mix.  But OneNote doesn’t have that.  My first instinct was to put it in quotes.  I didn’t think that would work, and it didn’t.  I next thought of using braces ‘[ ]’.  I really thought that was going to work, but it didn’t.  I scoured the drop down menus for some kind of hyperlink functionality.  Nothing.  I resorted to using help.  Nothing helpful.  It said to type in the link and it would automatically be created.  It’s like nobody thought about spaces in a link.  Not that it is an ideal thing to do, but it is not all that uncommon.  Luckily some online research provided some help (actually for Outlook).  Use chevrons ‘< >’, or if you are me use less than, greater than ‘< >’. 
This fixed my problem.  <Now I can link with as many spaces as I want when using OneNote>. 

Of course I’ll be using this everywhere now, just to see where it works.  You often find these Microsoft shortcuts work across many applications.  Try using ALT+Click/Drag the mouse sometime.  I learned that one using Visual Studio.  I was surprised to see that it also worked in Word. 

Notice that I filed this under 'duh'.  That's so I'll know where to look back a month from now when I forget how to add a link that contains spaces.

Thursday, April 06, 2006 5:42:49 AM (Pacific Standard Time, UTC-08:00) | Comments [1] | #
www. flickr .com