473,788 Members | 2,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

displaying html code in a textbox control

Is it possible to insert HTML codes to a textbox control ?

I am reading HTML formated string from sql server but if i assign this value
to Text property of TextBox, the format tags of HTML seems too...

sample string value from database:
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 11pt;
mso-bidi-font-weight: bold">
Sales Contract </SPAN></P>
<SPAN style="FONT-SIZE: 11pt; mso-bidi-font-weight: bold">Paragraph 7.
Buyer has the right to examine the goods upon receipt and has ____ days in
which to notify seller of any claim for damages based on the condition,
grade, quality or quality of the goods. Such notice must specify in detail
the particulars of the claim. Failure to provide such notice within the
requisite time period constitutes irrevocable acceptance of the goods.
<o:p></o:p></SPAN></P>
<P>&nbsp;</P>

The string is asked for in a textbox because of the scrollbars of textbox,

Are there any solutions to display html codes in textbox control or any
suitable control for this ...?

Thanks....
Jun 27 '08 #1
7 14510
Do Server.HtmlEnco de before assigning this to the Text property....

George.

"Ned White" <nedwhite@wro te in message
news:em******** ******@TK2MSFTN GP05.phx.gbl...
Is it possible to insert HTML codes to a textbox control ?

I am reading HTML formated string from sql server but if i assign this
value to Text property of TextBox, the format tags of HTML seems too...

sample string value from database:
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE:
11pt; mso-bidi-font-weight: bold">
Sales Contract </SPAN></P>
<SPAN style="FONT-SIZE: 11pt; mso-bidi-font-weight: bold">Paragraph 7.
Buyer has the right to examine the goods upon receipt and has ____ days in
which to notify seller of any claim for damages based on the condition,
grade, quality or quality of the goods. Such notice must specify in
detail the particulars of the claim. Failure to provide such notice
within the requisite time period constitutes irrevocable acceptance of the
goods. <o:p></o:p></SPAN></P>
<P>&nbsp;</P>

The string is asked for in a textbox because of the scrollbars of textbox,

Are there any solutions to display html codes in textbox control or any
suitable control for this ...?

Thanks....

Jun 27 '08 #2
On Wed, 16 Apr 2008 14:25:43 +0300, "Ned White" <nedwhite@wrote :
>Are there any solutions to display html codes in textbox control or any
suitable control for this ...?
As well as George's suggestion, you could use a WebBrowser control and
use its DocumentText property to load your text into it.

rossum

Jun 27 '08 #3
Hi George ,

I am trying this.

TextBox1.Text = Server.HtmlEnco de(DT.Rows[0][1].ToString());

But it seems in textbox like that:
&lt;P class=MsoNormal style=&quot;MAR GIN: 0cm 0cm
0pt&quot;&gt;&l t;B&gt;&lt;SPAN \r\nstyle=&quot ;FONT-SIZE:
11pt&quot;&gt;S ales Contract &lt;?xml:namesp ace prefix = o ns =
\r\n&quot;urn:s chemas-microsoft-com:office:offi ce&quot;
/&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;\r\n&lt; P
class=MsoNormal style=&quot;MAR GIN: 0cm 0cm 0pt&quot;&gt;&l t;B&gt;&lt;SPAN
\r\nstyle=&quot ;FONT-SIZE:
11pt&quot;&gt;& lt;o:p&gt;&amp; nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;\r\n

but the value is :
<P class=MsoNormal style=\"MARGIN: 0cm 0cm 0pt\"><B><SPAN
\r\nstyle=\"FON T-SIZE: 11pt\">Sales Contract <?xml:namespa ce prefix = o ns =
\r\n\"urn:schem as-microsoft-com:office:offi ce\"
/><o:p></o:p></SPAN></B></P>\r\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm
0pt\"><B><SPAN \r\nstyle=\"FON T-SIZE:
11pt\"><o:p>&nb sp;</o:p></SPAN></B></P>\r\n


Jun 27 '08 #4
by the way, I forgot that it is a c# web project and i am trying this on a
web form not a windows form.

Sory for the mistake..

Jun 27 '08 #5
On Apr 16, 9:39*am, "Ned White" <nedwhite@wrote :
by the way, I forgot that it is a c# web project and i am trying this on a
web form not a windows form.

Sory for the mistake..
Hi,
Good clarification :)

Just a Label, instead. Or a Literal control
Jun 27 '08 #6
If you using WebControls then they will do Server.HtmlEnco de automaticly.
So TextBox1.Text = DT.Rows[0][1].ToString();
That is why you end up encoding twice.. so <imgbecomes &lt;img&gt; and
then becomes &asmp;lt;img&am p;gt;

If you using HtmlControsl they do not do that so you will need
TextBox1.Value = Server.HtmlEnco de( DT.Rows[0][1].ToString() );

PS: I wish WebControls did not do encode too...

George.

"Ned White" <nedwhite@wro te in message
news:Os******** ******@TK2MSFTN GP06.phx.gbl...
Hi George ,

I am trying this.

TextBox1.Text = Server.HtmlEnco de(DT.Rows[0][1].ToString());

But it seems in textbox like that:
&lt;P class=MsoNormal style=&quot;MAR GIN: 0cm 0cm
0pt&quot;&gt;&l t;B&gt;&lt;SPAN \r\nstyle=&quot ;FONT-SIZE:
11pt&quot;&gt;S ales Contract &lt;?xml:namesp ace prefix = o ns =
\r\n&quot;urn:s chemas-microsoft-com:office:offi ce&quot;
/&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;\r\n&lt; P
class=MsoNormal style=&quot;MAR GIN: 0cm 0cm 0pt&quot;&gt;&l t;B&gt;&lt;SPAN
\r\nstyle=&quot ;FONT-SIZE:
11pt&quot;&gt;& lt;o:p&gt;&amp; nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;\r\n

but the value is :
<P class=MsoNormal style=\"MARGIN: 0cm 0cm 0pt\"><B><SPAN
\r\nstyle=\"FON T-SIZE: 11pt\">Sales Contract <?xml:namespa ce prefix = o ns
= \r\n\"urn:schem as-microsoft-com:office:offi ce\"
/><o:p></o:p></SPAN></B></P>\r\n<P class=MsoNormal style=\"MARGIN: 0cm 0cm
0pt\"><B><SPAN \r\nstyle=\"FON T-SIZE:
11pt\"><o:p>&nb sp;</o:p></SPAN></B></P>\r\n


Jun 27 '08 #7
Thanks George,

I use Panel control and <divtag combination instead of textbox.

the aspx code:
<asp:Panel ID="Panel1" runat="server" Width="100%" Height="100px"
BorderStyle="So lid" BorderWidth="1p x"
ScrollBars="Aut o" Style="padding: 10px">
<div id="ForTheDocs " runat="server">
</div>
</asp:Panel>

and the code-behind part:

ForTheDocs.Inne rHtml = Server.HtmlDeco de(DT.Rows[0][1].ToString());
Thanks a lot.
Jun 27 '08 #8

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

Similar topics

1
2272
by: Yoshitha | last post by:
hi I have datalist control in my ASP.NET application the problem here is i have used a textbox with multiline true propertly when i enter data like "fdjsfhjksdhfjsdfhsdjhfsdfhsdjfhsd jfdsjfksdjfksdjkfjsdfjksdjfsdjfd fdsfhjsdhfjsdhfjf dsjf dsjfhjsdfhjksdh d fdsjf hsdjkfhdjsfhsdjfh ds
2
8403
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when submitting the form to update the database. The server doesn't have the client side value any more. It seems to me that as I begin to write the client side javacript code for form validation and client side editing capabilities in order to save...
0
1227
by: Earl Teigrob | last post by:
I can create a new custom control (and not change it) and add it to the toolbox and drag it onto the disign screen and it works just fine, displaying the text . However, when I add the following datepicker control to the toolbox, it just shows a yellow dot and thats it. What happened to the text??? Earl
17
2496
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...
4
1976
by: clintonG | last post by:
Technically speaking, this issue is not about modifying the HTML generated by server controls but preceding the HTML generated by server controls with an HTML control generated on the basis of the type and the context of the server control itself. Clear as mud? :-) Consider the following server control... <asp:textbox id="MemberEmail" runat="server" ></asp:textbox> TextBox renders at run-time as an HTML control... <input...
3
3834
by: Al Wilkerson | last post by:
Hey, I have a Web Form with a drop down list, textbox, and search button. When click the search button an SQL server database is queried fordata. Once I have the data in a dataset I use the dataset to dynamically create a Html Table control. I want to display the table on another frame page (target="main") without the web form controls (i.e. the textbox, search button, and dropdown list). I just want the table displayed only on the...
3
2218
by: Richard Carpenter | last post by:
I understand how to use a dropdown list control to display the associated description value for a foreign key in a parent rather than the key itself, but I don't like having to disable the control when I want to prevent editing (simply displaying in the display template of a datalist or detailview control, for example). I've not been able to find a way to edit the disabled color of the dropdown list, so it appears very washed out - just...
7
1754
by: Ned White | last post by:
Is it possible to insert HTML codes to a textbox control ? I am reading HTML formated string from sql server but if i assign this value to Text property of TextBox, the format tags of HTML seems too... sample string value from database: <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 11pt; mso-bidi-font-weight: bold"> Sales Contract </SPAN></P> <SPAN style="FONT-SIZE: 11pt; mso-bidi-font-weight: bold">Paragraph...
7
6672
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a tabcontainer which has 1 panel already, however I want to try create the TabPanels dynamically. I followed the advice here: http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe Stagner)
0
9498
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
10366
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
10175
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
9969
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
8993
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
7518
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
6750
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3675
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.