WebControl HTML Rendering

Discussion in 'ASP .Net Web Controls' started by paul, Apr 28, 2004.

  1. paul

    paul Guest

    Is there a way to retrieve the HTML of a WebControl (ie DataList) after it has been rendered
    Let's say the DataList renders the below HTML after it's been databinded

    <table id="DataList1" cellspacing="0" border="0" ><tr><td><table border="0" cellspacing="0" width="100%" cellpadding="2"><tr><td valign="top" width="100%" colspan="2"
    Product Her
    </td></tr></table></table>

    What I was hoping for was a property of the DataList (ie DataList1.HTML) which would put the above into a string
    No such property seems to exist
    I thought maybe an attribute would be it (ie DataList1.Attributes["innerHTML"] but that raises an error

    any help is greatly appreciate
    thank
    pau
     
    paul, Apr 28, 2004
    #1
    1. Advertising

  2. paul

    David Jessee Guest

    Dim x As New tmpControl()

    Dim sw As New System.IO.StringWriter()

    Dim htw As New HtmlTextWriter(CType(sw, System.IO.TextWriter))

    x.RenderControl(htw)

    Dim controlHTML As String = sw.ToString()




    "paul" <> wrote in message
    news:...
    > Is there a way to retrieve the HTML of a WebControl (ie DataList) after it

    has been rendered?
    > Let's say the DataList renders the below HTML after it's been databinded.
    >
    > <table id="DataList1" cellspacing="0" border="0" ><tr><td><table

    border="0" cellspacing="0" width="100%" cellpadding="2"><tr><td valign="top"
    width="100%" colspan="2">
    > Product Here
    > </td></tr></table></table>
    >
    > What I was hoping for was a property of the DataList (ie DataList1.HTML)

    which would put the above into a string.
    > No such property seems to exist.
    > I thought maybe an attribute would be it (ie

    DataList1.Attributes["innerHTML"] but that raises an error.
    >
    > any help is greatly appreciated
    > thanks
    > paul
    >
     
    David Jessee, Apr 28, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    927
  2. Peter Mount
    Replies:
    4
    Views:
    985
    Peter Mount
    Jan 31, 2006
  3. Nathan Sokalski
    Replies:
    1
    Views:
    1,375
    Nathan Sokalski
    Jul 31, 2009
  4. Gergely Varadi

    WebControl rendering an ActiveX ctrl - design time problem

    Gergely Varadi, Jul 25, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    134
    Gergely Varadi
    Jul 25, 2003
  5. Andrew Jocelyn

    Adapting ReorderList WebControl for rendering dynamic html

    Andrew Jocelyn, Jan 5, 2009, in forum: ASP .Net Web Controls
    Replies:
    6
    Views:
    433
    Allen Chen [MSFT]
    Feb 3, 2009
Loading...

Share This Page