473,396 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

asp.net causes line breaks in javascript

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('exte ndednotes.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.op en('extendednotes.aspx?key
=18C2B4EB-F8B3-462B-AB74-7307D54DBEF7','ExtendedNotes_window','scrollbars=n o
,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.op en('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

Jul 19 '05 #1
1 2859


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.
"Sasha Shevelev" <sa*******@hotmail.com> wrote in message
news:uf**************@TK2MSFTNGP09.phx.gbl... 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('exte ndednotes.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.op en('extendednotes.aspx?key =18C2B4EB-F8B3-462B-AB74-7307D54DBEF7','ExtendedNotes_window','scrollbars=n o ,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.op en('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

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Travis Pupkin | last post by:
Hi, I'm putting together a site to allow someone to add content to a DB through a text area form, and then display it on the web. Pretty basic. The problem I'm having is that they need to add...
12
by: scott | last post by:
Is there a way to prevent IE from forcing a line break? Below in LISTING 2, you notice the table background image extention of '.jpg' begins a new line, instead of staying on the same line as it's...
11
by: Johnny Two Dogs | last post by:
I'm strictly concerned with IE, so cross-browser compatibilty isn't necessary. If you view the code below, I almost get exactly what I'm looking for: - A table of four cells that...
1
by: Sasha Shevelev | last post by:
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...
4
by: Water Cooler v2 | last post by:
Besides embedding <BR/>, like general purpose programming languages, I thought you could embed escape sequences such as \n or \r\n into string arguments to cause line breaks in JavaScript. To...
3
by: Wayne Deleersnyder | last post by:
Hi All, I'm trying to create a function that will cause a pop-up alert to appear if dates which were chosen from a drop-down list were invalid on a page. There's 4 dates, so there's the...
20
by: alice | last post by:
I'm doing some text swapping with javascript, got it working fine, but I would like the line to have line breaks and being a beginner, I don't even know if this is possible. So I have a line like...
4
by: Velhari | last post by:
Hi all, I wrote the following Javascript function used to execute the Javascript codes from the ajax response which contains both html & javascript. It works fine, if the javascript codes from...
4
by: Sunny | last post by:
Hi does anyone knows, How to remove line breaks from a string using javascript. I have a string like: <div <div class="style1">Yates<br>-47.13 but somehow the javascript is displaying string...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.