Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2006

Tip: Looking for answers? Try searching our database.

Displaying HTMl with htmlGenericControl

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rik Brooks - 21 Aug 2006 13:54 GMT
I have a web page that  has a placeholder on it called PlaceHolderText. I
read some html out of the database. The value for my test is:

this is <strong>a test </strong> of the html stuff

I read that into a variable that I call htmlData (it's a string)

htmlData = reader["html"].ToString();

Then, after making sure that htmlData is good and all, I do the following
two lines:

HtmlGenericControl ctl = new HtmlGenericControl(@htmlData);
PlaceHolderText.Controls.Add(ctl);

That outta show the data, with the appropriate words bolded. Instead it
shows the following (nothing bolded).

a test of the html stuff>a test of the html stuff>

Going through the debugger the value of htmlData is exactly what I expect it
to be. It gets muddied up by the htmlgenericcontrol

Anybody got a clue for me? Just a hint?

Signature

----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.

Animadverto est verus

Peter Bromberg [C# MVP] - 21 Aug 2006 16:00 GMT
Rik,
You aren't looking at your Intellisense. When you create an
HtmlGenericControl, it wants a tag name. Then you can set the other
properties (such as InnerHTML). Example:

private void Page_Load(object sender, System.EventArgs e)
{
string s="this is <strong>a test</strong> of the html stuff";
HtmlGenericControl ge = new HtmlGenericControl("div");
    ge.InnerHtml=s;
    this.PlaceHolder1.Controls.Add(ge);
}

BTW, this probably belongs on the ASP.NET newsgroup as it is quite "ASP.NET"
specific.
Peter

Signature

Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com

> I have a web page that  has a placeholder on it called PlaceHolderText. I
> read some html out of the database. The value for my test is:
[quoted text clipped - 20 lines]
>
> Anybody got a clue for me? Just a hint?
Rik Brooks - 21 Aug 2006 16:04 GMT
Thank you, Peter, this works great.

I'll try to find the asp.net newsgroup. I didn't see it. You're probably
right that's where it belongs
Signature

----------------------------------------
Magic is not in the hands of the magician but in the mind of the audience.

Animadverto est verus

> Rik,
> You aren't looking at your Intellisense. When you create an
[quoted text clipped - 37 lines]
> >
> > Anybody got a clue for me? Just a hint?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.