473,387 Members | 1,440 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,387 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 2858


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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.