R
Raymond Du
Hi,
I don't know if this is possible, I have a webform named genRept.aspx that
has a datagrid in it. From a VB class file, I would like to access the html
that datagrid in genRept.aspx renders. Here is my code snippets in VB class:
Dim getRept1 as new genRept
Dim strHTML as string
strHTML = genRept.getHTML()
getHTML is a public function in genRept.aspx.vb:
public function getHTML() as string
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Datagrid1.RenderControl(hw)
return tw.ToString()
end function
Err occurs at Datagrid1.RenderControl(hw), error message: Object reference
not set to an instance of an object.
Any suggestions?
TIA
I don't know if this is possible, I have a webform named genRept.aspx that
has a datagrid in it. From a VB class file, I would like to access the html
that datagrid in genRept.aspx renders. Here is my code snippets in VB class:
Dim getRept1 as new genRept
Dim strHTML as string
strHTML = genRept.getHTML()
getHTML is a public function in genRept.aspx.vb:
public function getHTML() as string
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Datagrid1.RenderControl(hw)
return tw.ToString()
end function
Err occurs at Datagrid1.RenderControl(hw), error message: Object reference
not set to an instance of an object.
Any suggestions?
TIA