Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

sending out Javascript from the server

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bjarke - 08 Sep 2007 18:51 GMT
I am working on an asp.net 2.0 web application, where I am making an
add to place on a different site. This add consists of some
dropdownboxes and some javascript.

the site on which the add is supposed to be has a table and the add is
included like this:

<td><script src="http:/someadress.aspx"></script> </td>

the source for the script consist of something like this:

document.write(" (the HTML for the add) ") and some more Javascript

I already have made the script file  so it works

THE QUESTION

How do you use asp.net 2.0 (C#) to generate the javascript
dynamically????

Please help

Bjarke
Mark Rae [MVP] - 08 Sep 2007 19:06 GMT
> How do you use asp.net 2.0 (C#) to generate the javascript
> dynamically????

http://msdn2.microsoft.com/en-us/library/z9h4dk8y(VS.80).aspx

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Bjarke - 08 Sep 2007 19:36 GMT
> > How do you use asp.net 2.0 (C#) to generate the javascript
> > dynamically????
[quoted text clipped - 4 lines]
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net

Thanks Mark I know the RegisterStartupScript function. It adds
whatever you tell it to add to the beginning of a web page. What I
need is something that is possible to link to like this:

<script type="text/javascript"  src="http://someAdress.aspx/
OrSomethingLikely"> (this snippet is supposed to be placed on a
different site that isnt even is powered by asp.net).

http://ditcentrum.dk/Nordjyske/OutputNordjyskeBlogs.aspx

Thanks

)
Bjarke - 08 Sep 2007 19:43 GMT
> > How do you use asp.net 2.0 (C#) to generate the javascript
> > dynamically????
[quoted text clipped - 4 lines]
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net

Thanks Mark I know the RegisterStartupScript function. It adds
whatever you tell it to add to the beginning of a web page. What I
need is something that is possible to link to like this:

<script type="text/javascript"  src="http://someAdress.aspx/
OrSomethingLikely"> (this snippet is supposed to be placed on a
different site that isnt even is powered by asp.net).

just like this link does:

http://ditcentrum.dk/Nordjyske/OutputNordjyskeBlogs.aspx

when it referred to like this:

<html>
<body>

<script type = text/javascript src="http://ditcentrum.dk/Nordjyske/
OutputNordjyskeBlogs.aspx"></script>

</body>
</html>

Thanks

Thanks
Göran Andersson - 08 Sep 2007 20:26 GMT
> I am working on an asp.net 2.0 web application, where I am making an
> add to place on a different site. This add consists of some
> dropdownboxes and some javascript.

I suppose that you mean an ad? ;)

> the site on which the add is supposed to be has a table and the add is
> included like this:
[quoted text clipped - 15 lines]
>
> Bjarke

Just remove all the markup in the page (except the @Page directive), and
use Response.Write in the code behind to write out the script as strings.

Signature

Göran Andersson
_____
http://www.guffa.com

Bjarke - 08 Sep 2007 22:56 GMT
Thanks G?ran!

Really nice and simple.
Bjarke - 10 Sep 2007 04:47 GMT
Just a small detail to finish the question.

The project I am working in is using themes. If I just delete
everything but the page directive I get an error.

So I disabled themes for that particular page as like it is shown
here
http://msdn2.microsoft.com/en-us/library/kx3kzht7(VS.80).aspx
on msdn.

I still get an error stating that I have to have a <head
runat="server"> section.

Is it possible to get rid of this?
Göran Andersson - 10 Sep 2007 07:54 GMT
> Just a small detail to finish the question.
>
[quoted text clipped - 10 lines]
>
> Is it possible to get rid of this?

When I make a page where I don't want the theming, I just put Theme=""
in the @Page directive.

Signature

Göran Andersson
_____
http://www.guffa.com


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.