473,756 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to add   in runtime

I create a HTMLTable in my C# code and then add rows and cells into that table.

I'm trying to set top and bottom border for each cell by using stylesheet
and it works as far as cell has some text in it.
If cell has no content at all, the borders do not show up (..strange)

So I tried to insert text inside each cell which has no other content
inside.

Cell content is set in code:
cell.InnerText = " ";

What I wanted to get parsed to HTML:
<td class="demo"> </td>

but instead I got:
<td class="demo">&n psp;</td>

Any solutions?

Nov 19 '05 #1
9 5835
Doh..
nbsp:s seems to work also in web based newsreader.
Maybe this works.

cell.InnerText = "&nbsp;";

"Jouni Karppinen" wrote:
I create a HTMLTable in my C# code and then add rows and cells into that table.

I'm trying to set top and bottom border for each cell by using stylesheet
and it works as far as cell has some text in it.
If cell has no content at all, the borders do not show up (..strange)

So I tried to insert text inside each cell which has no other content
inside.

Cell content is set in code:
cell.InnerText = " ";

What I wanted to get parsed to HTML:
<td class="demo"> </td>

but instead I got:
<td class="demo">&n psp;</td>

Any solutions?

Nov 19 '05 #2
Hi Jouni,
I'm trying to set top and bottom border for each cell by using stylesheet
and it works as far as cell has some text in it.
If cell has no content at all, the borders do not show up (..strange)
The normal behavior of browsers for an empty cells is not to display them.
So I tried to insert text inside each cell which has no other content
inside.
If you just put an " " (blank/space) in the cell most browsers will still
not display the cell.
but instead I got:
<td class="demo">&n psp;</td>


If you are getting &nbsp; not &npsp; then that is perfectly fine. &nbsp;
(non braking space) is the HTML Representation for space, and it forces the
browser to display that space, and there for the cell.

Hope that helps
Johannes
Nov 19 '05 #3
Why aren't you happy with <td class="demo">&n psp;</td>?

Eliyahu

"Jouni Karppinen" <Jo************ @discussions.mi crosoft.com> wrote in
message news:4A******** *************** ***********@mic rosoft.com...
I create a HTMLTable in my C# code and then add rows and cells into that table.
I'm trying to set top and bottom border for each cell by using stylesheet
and it works as far as cell has some text in it.
If cell has no content at all, the borders do not show up (..strange)

So I tried to insert text inside each cell which has no other content
inside.

Cell content is set in code:
cell.InnerText = " ";

What I wanted to get parsed to HTML:
<td class="demo"> </td>

but instead I got:
<td class="demo">&n psp;</td>

Any solutions?

Nov 19 '05 #4
My first message didn't show up correctly.

Output to HTML page was:
<td class="viewCell ">&amp;nbsp ;</td>
when using cell.InnerText = "&nbsp;";

"Eliyahu Goldin" wrote:
Why aren't you happy with <td class="demo">&n psp;</td>?

Eliyahu

"Jouni Karppinen" <Jo************ @discussions.mi crosoft.com> wrote in
message news:4A******** *************** ***********@mic rosoft.com...
I create a HTMLTable in my C# code and then add rows and cells into that

table.

I'm trying to set top and bottom border for each cell by using stylesheet
and it works as far as cell has some text in it.
If cell has no content at all, the borders do not show up (..strange)

So I tried to insert text inside each cell which has no other content
inside.

Cell content is set in code:
cell.InnerText = " ";

What I wanted to get parsed to HTML:
<td class="demo"> </td>

but instead I got:
<td class="demo">&n psp;</td>

Any solutions?


Nov 19 '05 #5
Hi Jouni,

if you use InnerHtml instead of InnerText it should work.

Johannes
"Jouni Karppinen" <Jo************ @discussions.mi crosoft.com> schrieb im
Newsbeitrag news:9B******** *************** ***********@mic rosoft.com...
My first message didn't show up correctly.

Output to HTML page was:
<td class="viewCell ">&amp;nbsp ;</td>
when using cell.InnerText = "&nbsp;";

"Eliyahu Goldin" wrote:
Why aren't you happy with <td class="demo">&n psp;</td>?

Eliyahu

"Jouni Karppinen" <Jo************ @discussions.mi crosoft.com> wrote in
message news:4A******** *************** ***********@mic rosoft.com...
> I create a HTMLTable in my C# code and then add rows and cells into
> that

table.
>
> I'm trying to set top and bottom border for each cell by using
> stylesheet
> and it works as far as cell has some text in it.
> If cell has no content at all, the borders do not show up (..strange)
>
> So I tried to insert text inside each cell which has no other content
> inside.
>
> Cell content is set in code:
> cell.InnerText = " ";
>
> What I wanted to get parsed to HTML:
> <td class="demo"> </td>
>
> but instead I got:
> <td class="demo">&n psp;</td>
>
> Any solutions?
>


Nov 19 '05 #6
I suspect you're having trouble because you're using InnerText rather than
InnerHtml on your HtmlTableCell. The value of InnerText is HTML encoded so
it makes sense that the "&" in "&nbsp;" would be converted to "&amp;".

HTH
----------------
Dave Fancher
http://www.davefancher.com

"Jouni Karppinen" <Jo************ @discussions.mi crosoft.com> wrote in
message news:9B******** *************** ***********@mic rosoft.com...
My first message didn't show up correctly.

Output to HTML page was:
<td class="viewCell ">&amp;nbsp ;</td>
when using cell.InnerText = "&nbsp;";

"Eliyahu Goldin" wrote:
Why aren't you happy with <td class="demo">&n psp;</td>?

Eliyahu

"Jouni Karppinen" <Jo************ @discussions.mi crosoft.com> wrote in
message news:4A******** *************** ***********@mic rosoft.com...
> I create a HTMLTable in my C# code and then add rows and cells into
> that

table.
>
> I'm trying to set top and bottom border for each cell by using
> stylesheet
> and it works as far as cell has some text in it.
> If cell has no content at all, the borders do not show up (..strange)
>
> So I tried to insert text inside each cell which has no other content
> inside.
>
> Cell content is set in code:
> cell.InnerText = " ";
>
> What I wanted to get parsed to HTML:
> <td class="demo"> </td>
>
> but instead I got:
> <td class="demo">&n psp;</td>
>
> Any solutions?
>


Nov 19 '05 #7
You got what you should get. &nbsp; is the HTML code for a space.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Jouni Karppinen" <Jo************ @discussions.mi crosoft.com> wrote in
message news:4A******** *************** ***********@mic rosoft.com...
I create a HTMLTable in my C# code and then add rows and cells into that
table.

I'm trying to set top and bottom border for each cell by using stylesheet
and it works as far as cell has some text in it.
If cell has no content at all, the borders do not show up (..strange)

So I tried to insert text inside each cell which has no other content
inside.

Cell content is set in code:
cell.InnerText = " ";

What I wanted to get parsed to HTML:
<td class="demo"> </td>

but instead I got:
<td class="demo">&n psp;</td>

Any solutions?

Nov 19 '05 #8
In addition to the other suggestions you can also do

cell.InnerText = "\u00a0";

Eliyahu

"Jouni Karppinen" <Jo************ @discussions.mi crosoft.com> wrote in
message news:9B******** *************** ***********@mic rosoft.com...
My first message didn't show up correctly.

Output to HTML page was:
<td class="viewCell ">&amp;nbsp ;</td>
when using cell.InnerText = "&nbsp;";

"Eliyahu Goldin" wrote:
Why aren't you happy with <td class="demo">&n psp;</td>?

Eliyahu

"Jouni Karppinen" <Jo************ @discussions.mi crosoft.com> wrote in
message news:4A******** *************** ***********@mic rosoft.com...
I create a HTMLTable in my C# code and then add rows and cells into that
table.

I'm trying to set top and bottom border for each cell by using

stylesheet and it works as far as cell has some text in it.
If cell has no content at all, the borders do not show up (..strange)

So I tried to insert text inside each cell which has no other content inside.

Cell content is set in code:
cell.InnerText = " ";

What I wanted to get parsed to HTML:
<td class="demo"> </td>

but instead I got:
<td class="demo">&n psp;</td>

Any solutions?


Nov 19 '05 #9
Thank you Johannes and Dave, InnerHtml worked.

"Dave Fancher" wrote:
I suspect you're having trouble because you're using InnerText rather than
InnerHtml on your HtmlTableCell. The value of InnerText is HTML encoded so
it makes sense that the "&" in " " would be converted to "&".

HTH
----------------
Dave Fancher
http://www.davefancher.com

"Jouni Karppinen" <Jo************ @discussions.mi crosoft.com> wrote in
message news:9B******** *************** ***********@mic rosoft.com...
My first message didn't show up correctly.

Output to HTML page was:
<td class="viewCell ">&nbsp;</td>
when using cell.InnerText = " ";

"Eliyahu Goldin" wrote:
Why aren't you happy with <td class="demo">&n psp;</td>?

Eliyahu

"Jouni Karppinen" <Jo************ @discussions.mi crosoft.com> wrote in
message news:4A******** *************** ***********@mic rosoft.com...
> I create a HTMLTable in my C# code and then add rows and cells into
> that
table.
>
> I'm trying to set top and bottom border for each cell by using
> stylesheet
> and it works as far as cell has some text in it.
> If cell has no content at all, the borders do not show up (..strange)
>
> So I tried to insert text inside each cell which has no other content
> inside.
>
> Cell content is set in code:
> cell.InnerText = " ";
>
> What I wanted to get parsed to HTML:
> <td class="demo"> </td>
>
> but instead I got:
> <td class="demo">&n psp;</td>
>
> Any solutions?
>


Nov 19 '05 #10

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

Similar topics

12
6035
by: Tjerk Wolterink | last post by:
In XHTML the entity nbsp stands for   A normal space like " " is also displayed as an normal space, but multiple spaces like " " are interpreted as 1 space in the xhtml page. So there comes the &nbsp; in handy: with "&nbsp;&nbsp;" you have two spaces. So with the nbsp entity you can create multiple spaces (in the display). Now i have an xml file with &nbsp; entities, i put it in an xsl-file that know xhtml entities.
12
47897
by: Robert Mark Bram | last post by:
Hi All, I am using the following trim function: function trim (str) { return str.replace(/^\s*/g, '').replace(/\s*$/g, ''); } The problem is that this doesn't trim instances of the "&nbsp;" char - the non breaking space. Can this be represented in a grep statement at
2
3312
by: Bill Green | last post by:
I am trying to add an indent to a Dropdown control. I prefix the text for the ListItem with a couple &nbsp; but it doesn't render the tags to spaces , instead the dropdown list shows: MainItem &nbsp;&nbsp;SubItem &nbsp;&nbsp;SubItem Thanks, --
2
1986
by: Rob T | last post by:
I have a dropdown list that I would like to put in a bunch of &nbsp;'s into it (I'm setting the font to a monospace font so I can show a couple of columns nice and neat). In the old asp days, I had no problem doing this, but now if I try to do something like this... boxOption.Items.Add(New ListItem("myFirstCol&nbsp;&nbsp;&nbsp;myLastCol")) ....it converts each & to a &amp;
1
1746
by: Vikram | last post by:
i am adding a row in dataset , in which i want to add &nbsp; (space chracter for html) and then want to bind dataset to asp.net dropdown list box. But & automatically converted to &amp chracter. Is there any way by which &nbsp; can be retained as it is when dropdown throws the html part. THanks
5
1704
by: Tim | last post by:
Hi, I am trying to load up a drop list with semi aligned columns like so: Item 2 Something Else etc. To do so, I have tried to fill the Text valus of ListItems like so:
3
8937
by: yawnmoth | last post by:
<? echo 'a'.trim(html_entity_decode('&nbsp;a&nbsp;')).'a'; ?> Shouldn't PHP output aaa? Looking at the documentation for trim I see that it doesn't support chr(0xA0) (eg. html_entity_decode('&nbsp;')), but it seems to me like it ought to...
28
13204
by: entfred | last post by:
I have the following line of html: &nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nbsp;&nbsp;&nbspyow In Internet Explorer 6.0, the columns look ok using the above html: 1234 abcd yow But, in firefox, for same html, getting this:
7
9785
by: Sebarry | last post by:
Hi, I'm having trouble creating a blank table row in Javascript using document.createElement( '&nbsp;' ). When I look at the generated source it has intrepreted it as <td>&amp;nbsp;</td>. What do I need to do? I've tried using single quotes, double quotes and backslash. Thanks, Sean
0
9255
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
9844
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9689
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
8688
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
7226
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
6514
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
5119
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3326
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.