Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 30th, 2007, 04:35 PM
Registered User
 
Join Date: Jul 2007
Location: Fort Walton Beach, FL, USA.
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>
Reply With Quote
  #2 (permalink)  
Old July 30th, 2007, 08:47 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
Reply With Quote
  #3 (permalink)  
Old August 14th, 2007, 09:07 AM
Registered User
 
Join Date: Jul 2007
Location: Fort Walton Beach, FL, USA.
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
Reply With Quote
  #4 (permalink)  
Old August 14th, 2007, 12:02 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:59 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.