AJAXing in .NET – #3 – Live Volta and Script#
- Example #1 – Plain ASP.NET Page with PostBacks
- Example #2 – ASP.NET AJAX with UpdatePanels
Post 3 (this post):
- Example #5 – Nikhil Kothari’s Script#
- Example #6 – Microsoft Labs Live Volta
#4. Microsoft Live Labs Volta
I previewed Microsoft Live Labs
In our Volta code-behind, we have the following logic.
public partial class VoltaPage1 : Page
photoPreview.Style.Display = “block”;
photoPreview.Src = “Images/” + photoList.Value;
partial void InitializeComponent()
That compiles, is easy to read, and type safe. Neato. The HTML code is identical to our prior examples, so a simple copy and paste from there. That saves some time.
It appears that Volta doesn’t appreciate resources that are not embedded. I’ve posted up to the Volta community groups and will slowly work through either a) rectifying what the correct code should be or b) accepting that this is “outside the scope” of the current Volta design. I can’t fathom having hundreds of embedded resources in a project—for simple graphics.
Finally, it appears the problem that Henry discussed in my last post also exists in Volta—Document.GetById isn’t case sensitive at all. :( Thanks Henry for the heads-up to keep that in mind!
[Update: 10 January 2008 : Danny van Velzen’s explaination in the forums helped out a lot. At this time, as expected, the CTP simply doesn’t support anything besides embedded resources; however, has logged the request as a future work item. *cheer* To work around this problem, he recommended a post-build event, which is basically a batch command. I’ve tried that out and this example works like a champ!
The only gotcha is figuring out where to copy the files to and what correlates to the “root” of your application. It’s not the root of our bin\Debug or bin\Output. It’s the Volta directory underneath. With that information, you can write up a quick event:
xcopy /i /y “$(ProjectDir)Images” “$(TargetDir)Volta\Images”
Given this simply copies the images for this prototype project; however, you could use these events to copy pages, .css, or anything that you didn’t feel like “embedding” into your project. As I noted on the Volta communities post—I’m looking forward to this maturing and having this functionality built into the compiler.🙂
With this updated information, I can finally compare implementation with our other options..
- HTML Code: 9, Code Behind: 5 with whitespace and method names.
- All tests come back clean—and Volta supports FireFox debugging out-of-the-box, which is great because I have come to prefer FireBug over the IE Developer Toolbar.
#5. Script# 0.4.5.0
The latest build of Script#, 0.4.5.0, appears to have a few glitches in the Scriptlet editor (cutting out the top and bottom lines, throwing compile errors when they don’t exist, etc) and after blowing through about a dozen project—it just won’t compile. Period.
Here’s the code for the class. It looks right, from what I have as examples, but blows up that I have extra “}” (which is a known bug apparently) and believes that my IDisposable doesn’t exist, though I see it right there.😦
public class Viewer : IDisposable
private SelectElement _photoList;
private ImageElement _photoPreview;
private DOMEventHandler _photoListOnChangeHandler;
public void PhotoListOnChange()
_photoPreview.Src = “Images/” + _photoList.Value;
public void Dispose()
if (_photoListOnChangeHandler != null)
_photoListOnChangeHandler = null;
I’m going to keep working with it (because the prototypes I have gotten working have worked well, but also don’t seem to work under 0.4.5.0) and I’ll update this post when I have more information. If anyone out there is a Script# expert and has 0.4.5.0 up and going with VS2008, email me, please.🙂.