Using a panel question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form where I have a treeview control in the left sidebar and then a
panel next to it in the other pane. Based on user selection from the tree
view, I would like the panel to display a certain html page that was created
in Word as html. Currently I do have the treeview's nodes pointing to a URL,
however for design asthetics, I would love to have the html page just open in
this panel.

How would I got about doing this and thanks for the help.
 
ASP:PANEL is a <DIV> tag when rendered to HTML and <DIV> cannot host another
HTML page. Adding an IFRAME to the right panel may be an option. IFRAME can
host new HTML/ASP/ASPX pages.
 
Brad,

I wouldn't go the iFrame route myself. You can certainly display the page in
the panel.

Put a literal control into the panel and then get the html code like this:

'---Create the request

Dim WebRequest As System.Net.WebRequest

WebRequest = System.Net.WebRequest.Create(New Uri(CurrentLink))

'---Optionally set the timeout (if you don't the default timeout will be
used)

WebRequest.Timeout = 2000

'---Get the response produced by the request

Dim Response As System.Net.WebResponse = WebRequest.GetResponse

'---Download the page content into a stream

Dim Stream As System.IO.Stream = Response.GetResponseStream

'---Place the stream into a stream reader

Dim StreamReader As New System.IO.StreamReader(Stream)

'---Read the stream into a string object

Dim Html As String = StreamReader.ReadToEnd

'---Cleanup for the next request

Stream.Close()

StreamReader.Close()

Literal1.Text = Html


Now, you may need to parse the html to remove html, head, and/or form tags
depending on what the html you are receiving contains. There are, of course,
tags that could mess up your page's display. But I use this technique to
display newsletters saved as html pages in an archive site and the
surrounding site's format is just fine in every browser. You'll just have to
test to see if any included tags mess things up and remove them from the
Html string if they do...

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
Yes,

I'd agree, if an iFrame is compatible for all potential users of the
application, then that would be the way to go. It's just that while iFrames
are being adopted by more browsers there are still a lot of users out there
who are using older browser versions or browsers that don't render
iFrames...

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top