vbscript in asp.net 2.0
Hello,
new to asp.net and wondering how you would implement vbscript within a 2.0 web page. The desired end result is to export a datagrid to Excel. Currently I have the code below, however, the page won't compile and it gives me the following error "only content controls are allowed on a content pages that contain contant controls". Doesn't make much sense to me. Any help would be greatly appreciated.
Thanks,
D
<script language="vbscript">
Sub exportbutton_onclick
Dim sHTML, oExcel, oBook
sHTML = document.all.item("DataList1").outerhtml
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
oBook.HTMLProject.RefreshDocument
oExcel.Visible = true
oExcel.UserControl = true
End Sub
</script>
|