Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 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 Display Modes
  #1 (permalink)  
Old February 25th, 2009, 05:41 PM
Friend of Wrox
 
Join Date: Sep 2007
Location: , , .
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default How to add a script file programtically?

Hi

I have a jquery script that I need to add to my pages through C# code. The way I am doing it now causes trouble with the .net ajax toolkit.

I have it like this

<script src="<%= ResolveClientUrl("Javascripts/jquery-1.3.1.min.js") %>" type="text/javascript"></script>

I am using ResolveClientUrl because I have some pathing issues if I don't.

But when I have anything from the toolkit I get this error

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

I found a person saying that to avoid this you have to put your script programatically in but I don't know how to do this.

Thanks
Reply With Quote
  #2 (permalink)  
Old February 25th, 2009, 05:49 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Please see the following blog post:

The Controls Collection Cannot Be Modified Because the Control Contains Code Blocks
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
Reply With Quote
  #3 (permalink)  
Old February 25th, 2009, 07:02 PM
Friend of Wrox
 
Join Date: Sep 2007
Location: , , .
Posts: 169
Thanks: 7
Thanked 2 Times in 2 Posts
Default

Quote:
Originally Posted by Lee Dumond View Post

Thanks your a lifesaver lol.

How would you add a script in C# codebehind? Just curious.
Reply With Quote
  #4 (permalink)  
Old February 26th, 2009, 06:58 PM
Friend of Wrox
 
Join Date: Mar 2008
Location: So Cal is good enough for you, California, USA.
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289
Default Using the Grid View

okay so basically i use the login control to make my account on my website (aside from the issue that i can not log in with that account more than once...), i want to use the gridview to show all the members. the problem is it shows everything, security answer/question, is online, provider, etc... i just want to pull out the isonline and UserName columns but idk what table the data is being held in i looked at the tables folder in the database manager on VWD and there is no table i see with those column names.

if anyone can show me how to display:

Member Name IsOnline

in a grid view. or anything like that. let me know...maybe i should use a different control? my thanks in advance
Reply With Quote
  #5 (permalink)  
Old February 26th, 2009, 07:01 PM
Friend of Wrox
 
Join Date: Mar 2008
Location: So Cal is good enough for you, California, USA.
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289
Default

oops. this isnt a new thread... my bad
Reply With Quote
  #6 (permalink)  
Old February 26th, 2009, 07:02 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Iceman,

I might suggest you post this question in a new thread, rather than sticking it in a totally unrelated thread like this. More people will see it that way.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
Reply With Quote
  #7 (permalink)  
Old February 26th, 2009, 07:14 PM
Friend of Wrox
 
Join Date: Mar 2008
Location: So Cal is good enough for you, California, USA.
Posts: 133
Thanks: 15
Thanked 1 Time in 1 Post
Send a message via ICQ to iceman90289 Send a message via AIM to iceman90289
Default

i know i know... i minimized the window and forgot where i was at... i thought i was making a thread but i was looking up the answer to his question.

use:

<%@ Page Language="C#" AutoEventWireUp="true" CodeFile="FirstPageCodeBehind.aspx.cs" Inherits=classname %>

Code File is self explanitory but Inherits links you to the class in the code file. just type a class name.
Reply With Quote
Reply


Thread Tools
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
File Uploading Script Problems mercury7 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 13 January 8th, 2009 08:13 AM
How to write a script to download file Ivanchan Other Programming Languages 0 January 24th, 2008 04:56 AM
Auto Update of script file.... rupen Javascript How-To 2 November 17th, 2006 10:03 AM
Add Date in Catalog Backup Script sagato Need help with your homework? 0 September 19th, 2006 04:25 PM
How to add client-side script to an ASP button BrianWren VB.NET 1 March 30th, 2005 04:27 PM



All times are GMT -4. The time now is 09:53 PM.


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