How do I - render url in server panel control


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: How do I - render url in server panel control

  1. #1
    David Hermansen Guest

    How do I - render url in server panel control


    I can put a panel control on my webform, add a literal control to it and write
    html to the panel.

    How can I get the html from a url and do the same thing?

    Thanks

  2. #2
    Constance J. Petersen Guest

    Re: How do I - render url in server panel control

    Hi David,

    "David Hermansen" <david.hermansen@anentsoftware.com> wrote in message
    news:3c780dbb$1@10.1.10.29...
    > I can put a panel control on my webform, add a literal control to it and write
    > html to the panel.
    > How can I get the html from a url and do the same thing?


    Here's a link to an article that explains the technique:
    http://www.4guysfromrolla.com/webtech/070601-1.shtml

    --
    Constance Petersen, DevX newsgroup section leader
    SoftMedia Artisans, Inc.
    http://www.smartisans.com
    For useful, usable software and Web sites
    Featured Web design: http://www.keweenawnow.com/
    --
    Please reply in the newsgroup so everyone can benefit




  3. #3
    David Hermansen Guest

    Re: How do I - render url in server panel control


    "David Hermansen" <david.hermansen@anentsoftware.com> wrote:
    >
    >I can put a panel control on my webform, add a literal control to it and

    write
    >html to the panel.
    >
    >How can I get the html from a url and do the same thing?
    >
    >Thanks


    Thanks for the href Constance.

    This works in a webform (VB.net v1 RTM).
    I didn't do any postbacks. I just tried to get it to work once.

    Option Explicit On
    Option Strict On
    Imports System.Net
    Public Class WebForm1

    Inherits System.Web.UI.Page
    Protected WithEvents Panel1 As System.Web.UI.WebControls.Panel
    Private objpanelhtml As New LiteralControl()
    Private objWebClient As New WebClient()
    #Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    End Sub

    #End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Handles MyBase.Load
    'Put user code to initialize the page here
    Dim byteRequestedHTML() As Byte
    Dim objUTF8Encoding As New System.Text.UTF8Encoding()
    Const strURL As String = "http://www.yahoo.com"
    Dim strRequestedHTML As String

    Me.Panel1.Controls.Add(objpanelhtml)
    byteRequestedHTML = objWebClient.DownloadData(strURL)
    strRequestedHTML = objUTF8Encoding.GetString(byteRequestedHTML)
    objpanelhtml.Text = strRequestedHTML
    End Sub

    End Class



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center