473,892 Members | 1,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

concat a space on an HTML controls innerText property

I want to concat a space in an HTML Control's innerText property. here is a
sample code

Dim celCreate As New HtmlControls.Ht mlTableCell()

celCreate.inner Text = " TEST"
When the page is displayed the spaces are not there! What can I do?

Thanks in advance
Nov 19 '05 #1
10 2798
try celCreate.inner Text = "  TE ST"

Nov 19 '05 #2
"=?Utf-8?B?QW5nZWw=?=" <An***@discussi ons.microsoft.c om> wrote in
news:C5******** *************** ***********@mic rosoft.com:
I want to concat a space in an HTML Control's innerText property. here
is a sample code

Dim celCreate As New HtmlControls.Ht mlTableCell()

celCreate.inner Text = " TEST"
When the page is displayed the spaces are not there! What can I do?


HTML doesn't allow for multiple spaces.

Instead... Replace(" TEST", " ", "&nbsp;")

Use &nbsp; for spaces.

--
Lucas Tam (RE********@rog ers.com)
Please delete "REMOVE" from the e-mail address when replying.

Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com
Nov 19 '05 #3


--
-Demetri
"Angel" wrote:
I want to concat a space in an HTML Control's innerText property. here is a
sample code

Dim celCreate As New HtmlControls.Ht mlTableCell()

celCreate.inner Text = " TEST"
When the page is displayed the spaces are not there! What can I do?

Thanks in advance

Nov 19 '05 #4
Browsers ignore white space (blank spaces beyond the first/only one if one
exists)

When you want more than one blank space, the solution is to explicitly place
a "nonbreakin g space" (&nbsp;) character for each blank space you want.

So, your code with three blank spaces would be this:
celCreate.inner Text = "&nbsp;&nbsp;&n bsp;TEST"

crazy but true.

-HTH

"Angel" <An***@discussi ons.microsoft.c om> wrote in message
news:C5******** *************** ***********@mic rosoft.com...
I want to concat a space in an HTML Control's innerText property. here is a
sample code

Dim celCreate As New HtmlControls.Ht mlTableCell()

celCreate.inner Text = " TEST"
When the page is displayed the spaces are not there! What can I do?

Thanks in advance

Nov 19 '05 #5


Angel wrote:
I want to concat a space in an HTML Control's innerText property. here is a
sample code

Dim celCreate As New HtmlControls.Ht mlTableCell()

celCreate.inner Text = " TEST"
When the page is displayed the spaces are not there! What can I do?


Understand that normal HTML rendering collapses several white space
characters to one inter-word space:
<http://www.w3.org/TR/html4/struct/text.html#h-9.1>
If you want to have significant white space then use a <pre> element e.g.
<pre> TEST</pre>
or use a character like a non breaking space  .

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 19 '05 #6
Thanks for the responses. I tried this but when the asp.net page is displayed
it translates

aCell.innerText = " TEST"

it displays it literally like you see it.

" TEST"

If I look at the source of the page it translated the Code as such:

<tr>&nbsp;&nbsp ;TEST</tr>

Any thoughts???

Thanks

"Jordan" wrote:
Browsers ignore white space (blank spaces beyond the first/only one if one
exists)

When you want more than one blank space, the solution is to explicitly place
a "nonbreakin g space" ( ) character for each blank space you want.

So, your code with three blank spaces would be this:
celCreate.inner Text = " TEST"

crazy but true.

-HTH

"Angel" <An***@discussi ons.microsoft.c om> wrote in message
news:C5******** *************** ***********@mic rosoft.com...
I want to concat a space in an HTML Control's innerText property. here is a
sample code

Dim celCreate As New HtmlControls.Ht mlTableCell()

celCreate.inner Text = " TEST"
When the page is displayed the spaces are not there! What can I do?

Thanks in advance


Nov 19 '05 #7
Sorry I meant:

aCell.innerText = " TEST"

"Angel" wrote:
Thanks for the responses. I tried this but when the asp.net page is displayed
it translates

aCell.innerText = " TEST"

it displays it literally like you see it.

" TEST"

If I look at the source of the page it translated the Code as such:

<tr> TEST</tr>

Any thoughts???

Thanks

"Jordan" wrote:
Browsers ignore white space (blank spaces beyond the first/only one if one
exists)

When you want more than one blank space, the solution is to explicitly place
a "nonbreakin g space" ( ) character for each blank space you want.

So, your code with three blank spaces would be this:
celCreate.inner Text = " TEST"

crazy but true.

-HTH

"Angel" <An***@discussi ons.microsoft.c om> wrote in message
news:C5******** *************** ***********@mic rosoft.com...
I want to concat a space in an HTML Control's innerText property. here is a
sample code

Dim celCreate As New HtmlControls.Ht mlTableCell()

celCreate.inner Text = " TEST"
When the page is displayed the spaces are not there! What can I do?

Thanks in advance


Nov 19 '05 #8
It will recognize and display one blank space - which is what you have. If
you want more, then you need &nbsp;


"Angel" <An***@discussi ons.microsoft.c om> wrote in message
news:2A******** *************** ***********@mic rosoft.com...
Sorry I meant:

aCell.innerText = " TEST"

"Angel" wrote:
Thanks for the responses. I tried this but when the asp.net page is
displayed
it translates

aCell.innerText = " TEST"

it displays it literally like you see it.

" TEST"

If I look at the source of the page it translated the Code as such:

<tr> TEST</tr>

Any thoughts???

Thanks

"Jordan" wrote:
> Browsers ignore white space (blank spaces beyond the first/only one if
> one
> exists)
>
> When you want more than one blank space, the solution is to explicitly
> place
> a "nonbreakin g space" ( ) character for each blank space you want.
>
> So, your code with three blank spaces would be this:
> celCreate.inner Text = " TEST"
>
> crazy but true.
>
> -HTH
>
>
>
> "Angel" <An***@discussi ons.microsoft.c om> wrote in message
> news:C5******** *************** ***********@mic rosoft.com...
> >I want to concat a space in an HTML Control's innerText property. here
> >is a
> > sample code
> >
> > Dim celCreate As New HtmlControls.Ht mlTableCell()
> >
> > celCreate.inner Text = " TEST"
> >
> >
> > When the page is displayed the spaces are not there! What can I do?
> >
> > Thanks in advance
>
>
>

Nov 19 '05 #9
You know what jordan I am writing my code as yyou specified and this message
that I am writing eliminated the HTML equvalent to the empty space. I do put
in my code as follows

aCell.innerText = Test

But what happens is that when the project runs the page gets translated and
the HTML that is outputed converts the ampersand up top to &nbsp;&nbsp;TES T.

any thoughts.

thanks.

"Jordan" wrote:
It will recognize and display one blank space - which is what you have. If
you want more, then you need


"Angel" <An***@discussi ons.microsoft.c om> wrote in message
news:2A******** *************** ***********@mic rosoft.com...
Sorry I meant:

aCell.innerText = " TEST"

"Angel" wrote:
Thanks for the responses. I tried this but when the asp.net page is
displayed
it translates

aCell.innerText = " TEST"

it displays it literally like you see it.

" TEST"

If I look at the source of the page it translated the Code as such:

<tr> TEST</tr>

Any thoughts???

Thanks

"Jordan" wrote:

> Browsers ignore white space (blank spaces beyond the first/only one if
> one
> exists)
>
> When you want more than one blank space, the solution is to explicitly
> place
> a "nonbreakin g space" ( ) character for each blank space you want.
>
> So, your code with three blank spaces would be this:
> celCreate.inner Text = " TEST"
>
> crazy but true.
>
> -HTH
>
>
>
> "Angel" <An***@discussi ons.microsoft.c om> wrote in message
> news:C5******** *************** ***********@mic rosoft.com...
> >I want to concat a space in an HTML Control's innerText property. here
> >is a
> > sample code
> >
> > Dim celCreate As New HtmlControls.Ht mlTableCell()
> >
> > celCreate.inner Text = " TEST"
> >
> >
> > When the page is displayed the spaces are not there! What can I do?
> >
> > Thanks in advance
>
>
>


Nov 19 '05 #10

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

Similar topics

4
4123
by: MB | last post by:
Hello everyone! These lines were inspired by the "DIV without line breaks" posted by Johnny Two Dogs on June 22. I know it is an old issue, but I want to share a few remarks that could be of interest for many members of this group. A brief summary is given below. However, you may want to take a look back at the original posting before continuing.
4
3203
by: keerthana_m_2003 | last post by:
Hello: is it possible to insert the value of some JavaScript variable in the body of HTML (for example the text on button, or at any part of the HTML text part). Please tell me how to do this. Thanks
7
1913
by: David Thielen | last post by:
Hi; This code is in J# so it looks a little weird but you could change it to C# in a couple of seconds. The problem here is a single space node returns as an empty node: public static void main(String args) throws Exception {
3
5874
by: Jon Davis | last post by:
I have a software application I've written called PowerBlog (PowerBlog.net) that takes the editing capability of the Internet Explorer WebBrowser control (essentially a DHTMLTextBox), extracts the user-typed HTML, assigns it as an XML node's InnerText property (using C#: System.Xml.XmlDocument obj; obj.InnerText = myHTML). Then I later get the InnerText as a string and write to disk. When this text is displayed in a web browser, special...
2
11528
by: ViperDK | last post by:
What is the best way for that? I store all Data in the original form in the Database. To prevent output fields (especially the fields everyone can use) to do bad things like killing the page-design or even worse attacking my site with javascript directives i use stuff like (WebControls.Label)Output.Text = HttpUtility.HtmlEncode(userDefinedData); and my own functions which allow Line-Breaks and handle links. But that way seems not to be...
17
2519
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control 'Button19' of type 'Button' must be placed inside a form tag with runat=server Can the IDE not do what it is supposed to do. It seems that it is a fight to make it do anything or did I do something wrong? It would seem silly to have to create a...
6
2382
by: martin | last post by:
Hi, I would like to write the text of an element to an xml doc as that it look like this <Address>&quot;Marty Jones&quot; &lt;mj@mydomain.com&gt;</Address> however I can't seen to get the quote marks to come out correctly the innertext property will change
4
4226
by: Zuel | last post by:
Hi Folks. So I have a small problem. My DoPostBack function is not writen to the HTML page nor are the asp:buttons calling the DoPostBack. My Goal is to create a totaly dynamic web page where the server generates the HTML based on a passed in parameter. In our case, CustomerID. Every Customer ges a branded website with there logos and webpage etc.. To Avoid having 1 ASP.Net application running for each client I am attempting a more...
6
1560
by: Lloyd Sheen | last post by:
Perhaps I have missed something but what I would like to do is have a more "controlled" method of generating HTML from a web service. I can create items using HtmlTable, HtmlTableRow, and HtmlTableCell but is there a quick method once the table has been built to get the HTML, put it in a string for return the browser call for the web service? I notice that HtmlTable does not support InnerHtml so that is not doable. Ideas??
0
9830
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11241
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10468
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9644
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7172
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6065
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4279
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3288
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.