I am trying to dynamically create a radgrid and render it to HTML so that I can email it to users. I
have all the data I need and the formatting of the actual grid control
finished. However, this is running in a batch process (not an aspx
page) so I am dynamically creating a dummy page, populating the grid and
trying to render it to html using the code below. However, on the call
to 'RenderControl' I get an exception: 'The control with ID 'RadGrid1'
requires a ScriptManager on the page. The ScriptManager must appear
before any controls that need it.'. Can anyone pls advise how to do
this :)
Thanks
Public Function ExecuteRadgridReport(report As IReport, ByVal params As Object(), ByVal userid As Integer) As String
Dim p As New Page
p.EnableEventValidation = False
Dim form As New HtmlForm
p.Controls.Add(form)
form.Controls.AddAt(0, New ScriptManager)
Dim x As New Telerik.Web.UI.RadGrid
x.MasterTableView.GroupsDefaultExpanded = True
x.ID = "RadGrid1"
form.Controls.Add(x)
ExecuteRadgridReport(x, report, params, userid)
'Render the grid to html
Dim sw As New StringWriter()
Dim htw As New HtmlTextWriter(sw)
x.RenderControl(htw)
'Return the html
Return sw.ToString()
End Function
have all the data I need and the formatting of the actual grid control
finished. However, this is running in a batch process (not an aspx
page) so I am dynamically creating a dummy page, populating the grid and
trying to render it to html using the code below. However, on the call
to 'RenderControl' I get an exception: 'The control with ID 'RadGrid1'
requires a ScriptManager on the page. The ScriptManager must appear
before any controls that need it.'. Can anyone pls advise how to do
this :)
Thanks
Public Function ExecuteRadgridReport(report As IReport, ByVal params As Object(), ByVal userid As Integer) As String
Dim p As New Page
p.EnableEventValidation = False
Dim form As New HtmlForm
p.Controls.Add(form)
form.Controls.AddAt(0, New ScriptManager)
Dim x As New Telerik.Web.UI.RadGrid
x.MasterTableView.GroupsDefaultExpanded = True
x.ID = "RadGrid1"
form.Controls.Add(x)
ExecuteRadgridReport(x, report, params, userid)
'Render the grid to html
Dim sw As New StringWriter()
Dim htw As New HtmlTextWriter(sw)
x.RenderControl(htw)
'Return the html
Return sw.ToString()
End Function