Fixed Header Extender for GridView in ASP.Net

It always seems like there is an endless supply of reports/tables that need to be created. And one of the requests that comes up with them is to make the headers freeze so you can scroll the rest of the information. It's fairly easy to do, just add a div around the table with a set height and overflow set to auto, set the header of the table to relative positioning, and you're done. However, if you've tried this with a Gridview, you'll notice that it gets a bit annoying. It's doable, but it's a bit annoying. So to help out, I created an extender that sets everything up for me:

FixedHeaderExtender.zip (1.54 kb)

It's pretty basic and very similar to the other extenders (uses the AJAX Toolkit, etc.). All you need to do is set the target control to the GridView and set the height that you want the grid to be. You can still format everything the way that you have in the past, etc. and it doesn't change anything along those lines. All that it does is freezes the headers and allows the other items to scroll. So definitely give it a try, leave feedback, and happy coding.

kick it on DotNetKicks.com   Shout it
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkListEmail

Posted by: James Craig
Posted on: 11/5/2008 at 12:48 PM
Tags: , ,
Categories: AJAX | ASP.Net | Web Design
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Web Page Screen Shot for ASP.Net

If you've looked at my site and scrolled over any of the links, you've probably noticed that a popup comes up (well in IE it does any way, if you have javascript turned on).  So maybe you haven't seen it, but if you have you'll notice that it's a service by Snap. You add in their javascript and they'll automatically add a contextual popup (usually an image of the site) for each link. Depending on your view, this is either very annoying or fantastic.  The main issue with the service that Snap provides is it can't view an internal website. So what can you do if you want to have the same functionality on an intranet?

In a recent post, I mentioned how to take a screenshot of a web page on the fly and convert it to a PDF. We can use the same code (so go download it), to create a similar functionality to the one Snap provides.

LinkVisualizerExtender.zip (3.04 kb)

The zip file above contains two items. The first is an extender. This extender simply takes a div as input and will attach itself to every link inside that div (mouseover and mouseout events). When the mouseover event is fired, it positions a div underneath the link, and calls a handler (the second item in the zip file) to load an image. The handler is called PageToImage. This item takes in a max size for the resulting image and a URL which you want to change into an image. This handler uses the code from the other post to get the screenshot, so you'll need it as well.

Please note that this is very basic example and was intended more as a proof of concept than anything. I'd definately add a div as a secondary target that would hold the image of the link (so I could format it however I wanted), add a property to define the size of the image (at present it's static at a max size of 500 pixels), maybe another property to define where I wanted to place the item (top, bottom, left, etc.), and maybe some sort of animation if you really want. None of that would be too difficult to add really.

The handler also needs to be changed as it doesn't know where you want to place the images (there's a FolderName string object that needs to be filled in). Other than that though, it works fine (even caches the item on the client side as well as on the server). The only thing I might add there is some code to have the server side cached item die off after X number of days. That would be it though.

Anyway, download the code, try it out, and happy coding.

kick it on DotNetKicks.com   Shout it
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkListEmail

Posted by: James Craig
Posted on: 9/29/2008 at 12:19 PM
Tags: ,
Categories: AJAX | ASP.Net | Web Design
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

TextArea Resizing Extender for ASP.Net and .Net is a Failure

Before I give you the code, I figured I'd share a list with you that I found on PC Magazine. Go to that link and notice number eight on the list... I had no idea that .Net was a failure. I mean everything else on that list makes sense, but .Net? You might as well put the iPhone on the next page then because it only sold 5 million or so last quarter... I will say though that Android looks pretty sweet though and I could see it taking over, but Google isn't "elitist" like Apple (which seems to work for Apple for some reason, I just find it annoying though). Then again I hate cell phones, so meh... Now if Google comes out with a music player that doesn't tie me to an iTunes like system (not to mention a proprietary format), with perhaps a web based storage system for my music, not to mention FM radio, legal sharing of songs, etc. I'd be all over that.  So basically I'm asking for a Zune with a couple extra features and doesn't suck, I guess (Although the next version looks promising).

Anyway, on to the code. This is another extender (once again, really basic). All this extender does is increases/decreases the size of a text area whenever someone types in it (thus making it so that they don't have to scroll). And as always I've packaged this one in a nice little zip file (note that you're going to need the AJAX Toolkit to get it working most likely):

TextAreaResizerExtender.zip (1.55 kb)

I'm sure this extender could be useful in certain situations but I have no idea what they would be. I really just created this one because I was bored... Basically I'm stuck creating reports at the moment and it's not exactly the most challenging work... Time consuming, but not that challenging.  Anyway, download the code, give it a try, leave feedback, and happy coding.

kick it on DotNetKicks.com   Shout it
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkListEmail

Posted by: James Craig
Posted on: 9/23/2008 at 12:42 PM
Tags: ,
Categories: AJAX | ASP.Net | Web Design
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed