Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 30th, 2007, 04:35 PM
Registered User
 
Join Date: Jul 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ufdylan
Default 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>
 
Old July 30th, 2007, 08:47 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The short answer is that you don't use VBScript in .NET. You use VB.NET.

However, I believe what you are asking is how to use VBScript as the client scripting language (versus javascript). Is this correct?

-Peter
 
Old August 14th, 2007, 09:07 AM
Registered User
 
Join Date: Jul 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ufdylan
Default

Yes, I am trying to export a datalist to excel. Prior to having the page within a content region the vbscript worked. Now it doesn't.
thanks,
D
 
Old August 14th, 2007, 12:02 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

can you post the relevant parts of the code? You probably don't need to post all the code of the script itself, but the parts of the page markup that affect where the script shows up in the rendered HTML.

Maybe also post the relevant parts of the rendered HTML from the browser.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
VBScript for Client-side controls in ASP.net cJeffreywang ASP.NET 1.0 and 1.1 Professional 1 March 22nd, 2007 08:02 PM
Putting VBScript in an ASP.NET page jturlington ASP.NET 1.0 and 1.1 Basics 1 May 14th, 2005 09:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.