asp.net causes line breaks in javascript

J

Juan Valera

I had a similar problem, my javascript has some document.write("< HTML stuff
In my case the error is in the editor, when it opens the file it inserts
some breaklines after the > signs and the write() is useless. If the source
is fixed and saved the error does not occurs anymore. I tried to find the
right editor settings, but after a while I gave up. Now, every day, when the
files are first open I look for these lines (not many in may case) and I
manually fix it.
 
S

Sasha Shevelev

Hi there,

I can;t believe no one else has had this prob but here goes...

I add some javascript into my page and asp.net sometimes (not always) puts
the js into my page with a line break rendering it useless...


Here is my code...

Dim txtDetails As TextBox = CType(e.Item.FindControl("txtDetails"), TextBox)
'Create the javascript string

strJS =
"javascript:ExtendedNotes_window=window.open('extendednotes.aspx?key=" & key
&
"','ExtendedNotes_window','scrollbars=no,width=480,height=300');ExtendedNote
s_window.focus()"

txtDetails.Attributes.Add("onClick", strJS)



Here is the source wjhen it runs.....

When it works the source code looks like (take wrapping off) - <input
name="dgrdTimeSheet:_ctl2:txtDetails" type="text" maxlength="20"
readonly="readonly" id="dgrdTimeSheet__ctl2_txtDetails" class="soft"
onClick="javascript:ExtendedNotes_window=window.open('extendednotes.aspx?key
=18C2B4EB-F8B3-462B-AB74-7307D54DBEF7','ExtendedNotes_window','scrollbars=no
,width=480,height=300');ExtendedNotes_window.focus()" style="width:80px;" />

When it doesn't - <input name="dgrdTimeSheet:_ctl2:txtDetails" type="text"
maxlength="20" readonly="readonly" id="dgrdTimeSheet__ctl2_txtDetails"
class="soft"
onClick="javascript:ExtendedNotes_window=window.open('extendednotes.aspx?key
=18C2B4EB-F8B3-462B-AB74-7307D54DBEF7
','ExtendedNotes_window','scrollbars=no,width=480,height=300');ExtendedNotes
_window.focus()" style="width:80px;" />

This obviously causes unterminated string constant. It's not the editor I
view my source in either. I saw another posting similar to mine and the guy
had checked all the characters but no one provided an answer to him.

This is really urgent. Can anyone help????

Thanks,

Sasha
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top