Rendering a usercontrol to obtain html output in webservice

C

Choi Han Choong

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
rendered.

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

Dim uc as New UserControl
uc.LoadControl("~/Controls/Report.ascx")

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?

Thanks.
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top