Copy to Clipboard AJAX Control

This is actually the same code that I used for the BlogEngine.Net extension that I created a while back. However I needed it to be a bit more generic (not BlogEngine specific) and take the code from a text box so I ended up creating an AJAX extender:

CopyToClipboardExtender.zip (2.07 kb)

It's rather basic. The targetID is the link you want them to click on to copy the text. The CopyID is the text box's ID. It most likely will not work in Firefox, etc. and is really only IE specific. However it's better than nothing. 

As far as setting it up, sometimes I get a bit lazy when it comes to explaining how to use some of the code on here. In the case of the AJAX controls, I usually leave out the fact that you need to download the AJAX Control Toolkit. Once you have that and you've added the templates, etc. like it says in the setup, you need to create an ASP.Net AJAX Control Project (I've used the name of AJAXControls, so if you use something different you'll need to potentially change some of the code to point to the correct namespace). From there, you add the code (making sure to have the js file as an embedded resource). Compile and you're ready to go...

Now that jQuery is going to be the norm, the setup process will probably change in the future. Plus I plan on packaging these up at some point like the utilities. For now though I leave you with the code. So try it out, 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: 12/12/2008 at 10:00 AM
Tags: , , ,
Categories: AJAX | ASP.Net | Web Design
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

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

Text Scrolling with ASP.Net and AJAX

I've been working on a desktop app for internal marketing purposes... It was an interesting blend of web and desktop  development as the client had to open up a website and display it. Rather simple really, however they wanted some animation. However, what they asked for was rather generic, so I built it into an extender (on my own time) and I'm putting it out here for the world to use.

This extender is rather basic, as always (as always, you're going to need the AJAX Toolkit to compile it). Anyway, in this instance I needed something that scrolled a bit of text inside of a div from the bottom of the div to the top, hiding any overflow. That was it really. I could always use the marquee tag, but I'm not big on using anything nonstandard...  So what I came up with was this:

TickerExtender.zip (1.87 kb)

In order to use it, all you need to do is set the TargetID to the div that holds the text you want to scroll and the amount of time (in seconds) that you want it to take (Delay field).  Also, it changes three things of the div you specify:

  1. It creates a div inside of it to hold the information and scrolls this inner div.
  2. It makes the div you specify absolutely positioned.
  3. It sets the overflow of the div to hidden.

That's it in terms of unexpected consequences. Other than that, it'll just constantly scroll that text. You may wish to change the code and add some features (scrolling in any direction, maybe some fading effects, etc.), but if not just download the code, give it a try, and happy coding.

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

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