If that is the exact line from your code, then it just has to do with how
your formed your string. You cannot insert a line break in a string in C#.
It should work if you change your code to read:
Page.RegisterClientScriptBlock("adder", "<script>function " +
"doadd(){document.all.TextBox3.value=eval(document .all.TextBox1.value) +
" +
"eval(document.all.TextBox2.value)}</script>");
or, for more readability, I always for my javascript in a temp variable
first. Just kinda hard to read otherwise
string script = "<script>function " +
"doadd(){document.all.TextBox3.value=eval(document .all.TextBox1.value) +
" +
"eval(document.all.TextBox2.value)}</script>"
Page.RegisterClientScriptBlock("adder", script);
either way, both of those should work for you.
-Cliff
"Ivan Demkovitch" <i@a.b> wrote in message
news:Of*************@tk2msftngp13.phx.gbl...
Hi!
I'm trying to add script to the page and place following code in my ascx
(control):
Page.RegisterClientScriptBlock("adder", "<script>function
doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value) +
eval(document.all.TextBox2.value)}</script>");
It doesn't work giving me all kind of problems...
I suspect the problem is with <> charachters.
How do I go around this problem?
Also, placing this line in code (I use WebMatrix) will mess up all HTML
code??
Thanks!