I noticed Patrick’s post about someone’s demo of ajax webparts.  Well for a while I have been working on this, but not in .NET 2.0 but in 1.1 on the 2003 version of sharepoint.

This has taken quite some time, admittedly as I was fitting it in the spare time I had.  The Http Handler example I talked about earlier was the spark, I had been trialling using this with external web services having trouble with security etc with my client scripts.  Eventually I had a prototype, but this was very messy. 

Now I have a complete example, but I am breaking it down into pieces.  First is the Dynamic Update Panel control.  This is a .NET 1.1 server control that generates all the jscript for a page, allows multiple instances per page of a popup each working independantly of one another.

The picture shown is a crop of a sharepoint portal page.  You can see a webpart with its title and two lines of text.  The Free floating draggable border thing, is the Popup Update panel.  By clicking on a link the AJAX magic makes a request and populates the panel with HTML. 

This is a link to the Source Code for you to try.

There are some things you need to know.

The project uses Build events to copy the latest version of the .js to the aspnet_client folder.

The project should be GAC’d (well yes and no but GAC it anyway).  Check the SNK location in the assembly.cs file.

You will need to make sure the aspnet_client script exists on install.

There is also a test project included that uses the control in an aspx page, configure that, the reference to the Control will be wrong etc.

Your paths are not the same as mine!

Once this is working you can try the next stage of this which is an Ajax Web part that uses this control.  Coming soon. Can you guess what it is yet ?

*Note.  You try this at your own risk, I nor my employer takes any responsibility for this code.  Use your common sense.  If it breaks you have only yourselves to blame.

Thanks to Mark Sheppard, I stole his find the aspnet_client folder code.  Thanks to Dave for letting me post what has been a work/my time project.

This project is still a work in progress. 

Better Firfox and IE handling for dragging and overflow is required.  A choice of GET/POST for the HTTPRequest is required.

Stylesheets

Ability to name parameters passed to the httpRequest (currently fixed to KeyValue1 etc up to 5 max, look at the code you’ll see why, I’m slack).

I’m considering XML/XLST client side rendering instead of HTML output also.

And many more changes besides.

Advertisements