As an aside, I develop in
asp.net with prototype, and I can relate to what Iain is saying- you have to define your markup twice, however.. don't jump on the asp-bashing bandwagon just yet- you'd have to do the same in any server side language- cold fusion, php, asp; they all suffer from this.
Unless you develop your application to be completely client side driven, where the data is sent to the client and it is *transformed* to markup using templates, new Element et al; you end up having to place your markup in two places.
How do others get around this problem? it's a pain to decide, for example, a column needs to be in another position and having to change the markup in two places.
I can think of 3 solutions.
Solution 1
Store the 'template' data on the server side. Write a class to retreive it on the server side, and use (.net here) reflection to dynamically evaluate it, thus meaning the same markup structure #{key} can be used. On the client side, extend new Template so that the markup can be retreived from a URL.
Solution 2
Keep your markup entirely on the server, render the page as per normal except always render a hidden version of the markup with no data fields evaluated - then when the user changes data, grab the blank version and interpolate/evaluate your changes into it.
Solution 3
Store your markup in .js files and parse them on the server. do the same as 1.
Iain, I've not tried using js from a runat=server tag but I expect it's something to do with prototype being fairly advanced js and the microsoft interpreter being 'jscript'.
i would lean towards trying to find a different way to structure your application so that you don't need to include prototype on the server.
What variation are you using?
vb.net / c#? .net 1 / 2? and what specific functions were you trying to leverage in prototype for use on the server?
I don't want to wind the PHP folk up here, but being able to leverage the .net framework and especially the Visual studio IDE speeds development up for me.
I know there are similar ide's available for other languages but I tend to feel that the php style of coding <? insert script here between your html ?> is way too similar to the classic asp <% insert script here %> model which never really worked in the first place.
PHP is definitely more advanced than classic asp, due to the large library of functions available, but I hasten to point out that the grass is *always* greener on the other side. Don't let the opinion of 'asp' cloud your judgement of
asp.net as it's come a long long way.
Gareth