HTML Data generated by Server.Controls

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lucky

    #1

    HTML Data generated by Server.Controls

    hi guys!
    i've got very interesting problem. it is like this.
    is it possible to get HTML generated by the server control in code
    behind?

    i'm developing an asp.net web application where i need to fectch data
    in HTML format. The data is rendered by the Data Repeater in Table
    format on webpage.

    is there any way i can get reder data of data repeater from itself? i
    mean is there any method of anyway to get html data from HTML Control?
    like GetHTML() or any properties or work around?

    i tried with RenderControl() method but i failed.

    the HTML Render Data generated by the Data Repeater is this :
    <Table>
    <tr>
    <th>Col1</th>
    <th>Col2</th>
    <th>Col3</th>
    </tr>
    <tr>
    <td>Col1</td>
    <td>Col2</td>
    <td>Col3</td>
    </tr>
    </Table>

    i want this data in code behind.

    if anyone know please let me know.

    Lucky

  • Andrew Morton

    #2
    Re: HTML Data generated by Server.Controls

    Lucky wrote:
    i've got very interesting problem. it is like this.
    is it possible to get HTML generated by the server control in code
    behind?
    >
    i'm developing an asp.net web application where i need to fectch data
    in HTML format. The data is rendered by the Data Repeater in Table
    format on webpage.
    >
    is there any way i can get reder data of data repeater from itself? i
    mean is there any method of anyway to get html data from HTML Control?
    like GetHTML() or any properties or work around?
    You could generate the HTML yourself instead of using a Data Repeater.

    Sometimes the ready-made widgets just don't have what you need -
    <mini-rant>for example, the asp:image control uses style="..." to set width
    and height which is utterly useless to a browser trying to lay out a table
    before the image data has been received, so you have to use an asp:label and
    build the HTML yourself.<and breathe>

    Andrew


    Comment

    • Ignacio Machin \( .NET/ C# MVP \)

      #3
      Re: HTML Data generated by Server.Controls

      Hi,

      Well it's not common to start with.

      A path would be
      First check if there is any event that gives you access to the html being
      generated (not sure if it does exist)
      If not then you will have to use the stream where all the controls write its
      client side code. maybe you can replace it with one of your own. (not sure
      if possible)

      Finally you could derive your control and override the Render method you
      will have easy access to the stream of rendered html


      --
      --
      Ignacio Machin,
      ignacio.machin AT dot.state.fl.us
      Florida Department Of Transportation



      "Lucky" <tushar.n.patel @gmail.comwrote in message
      news:1158059676 .701008.311030@ m73g2000cwd.goo glegroups.com.. .
      hi guys!
      i've got very interesting problem. it is like this.
      is it possible to get HTML generated by the server control in code
      behind?
      >
      i'm developing an asp.net web application where i need to fectch data
      in HTML format. The data is rendered by the Data Repeater in Table
      format on webpage.
      >
      is there any way i can get reder data of data repeater from itself? i
      mean is there any method of anyway to get html data from HTML Control?
      like GetHTML() or any properties or work around?
      >
      i tried with RenderControl() method but i failed.
      >
      the HTML Render Data generated by the Data Repeater is this :
      <Table>
      <tr>
      <th>Col1</th>
      <th>Col2</th>
      <th>Col3</th>
      </tr>
      <tr>
      <td>Col1</td>
      <td>Col2</td>
      <td>Col3</td>
      </tr>
      </Table>
      >
      i want this data in code behind.
      >
      if anyone know please let me know.
      >
      Lucky
      >

      Comment

      Working...