The best way I've found to do this is to create a static class MessageBox with a static method Show(), which will give you the ablility to to still use the syntax MessageBox.Show("Your Message"); and convert it into window.alert("Your Message");.
The javascript alert() function is limited as it doesn't provide any overloads for changing the caption of the MessageBox, but it still works nicely.
I've written a how to on my blog at:
http://sceptermt.blogspot.com/2008/0...lass-in-c.html that shows the source code that I used in C# for my web application and details on how it works.
You could also write overloads for the static show() method to allow the class to do a javascript confirm() or a prompt(). I haven't needed that functionality yet so I've just kept it simple.
Check This out:
http://www.sceptermarketingtechnologies.com