Rendering a usercontrol to obtain html output in webservice

Discussion in 'ASP .Net' started by Choi Han Choong, Aug 18, 2005.

  1. Hi,
    Would like to know if what I am trying to do is possible.

    I have a usercontrol(ascx) that basically contains a datagrid.

    I would like to save the output of this usercontrol to a file when a
    webservice method is called.

    I tried with the following but it does not seems to work. Nothing is

    Dim tw As New System.IO.StringWriter
    Dim hw As New System.Web.UI.HtmlTextWriter(tw)

    Dim uc as New UserControl

    uc.RenderControl( hw)

    Return tw.ToString

    It seems the datagrid is not init or loaded. Even if I called
    uc.BindData before call to render, the grid does not seems to get init.

    Is what I am trying to do possible? If not any other way to get what I
    wanted to do?

    Choi Han Choong, Aug 18, 2005
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.