PC Review


Reply
Thread Tools Rate Thread

[ASP.NET] How to add javascript between two specific tag?

 
 
tranky
Guest
Posts: n/a
 
      29th Aug 2006
Hi asp.net programmers,i've a question for you!

How to add javascript between two specific tag?
( for example div tag )

This javascript i must add in the page is a control, and i must
insert it beetween two div tag.

If use this.Page.ClientScript.RegisterClientScriptBlock,
the control is added in the head of the page, instead, if i use
this.Page.ClientScript.RegisterStartupScript the control is added in the
footer of the page.

In what way i can resolve this issue?

thanx
 
Reply With Quote
 
 
 
 
tranky
Guest
Posts: n/a
 
      29th Aug 2006
the final result should be this:

<body>

ecc...
ecc...

<div id="thisid">
<script ....>
// HERE THE JAVASCRIPT
</script>

</div>

ecc...
ecc...

</body>
 
Reply With Quote
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      29th Aug 2006
IN THEPAGE:

<div id="scriptdiv">
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
</div>



IN THE CODEBEHIND:


string scr=@"<script>alert('yo!');</script>";
HtmlGenericControl gc = new HtmlGenericControl();
gc.InnerHtml=scr;
this.PlaceHolder1.Controls.Add(gc);


-- Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"tranky" wrote:

> Hi asp.net programmers,i've a question for you!
>
> How to add javascript between two specific tag?
> ( for example div tag )
>
> This javascript i must add in the page is a control, and i must
> insert it beetween two div tag.
>
> If use this.Page.ClientScript.RegisterClientScriptBlock,
> the control is added in the head of the page, instead, if i use
> this.Page.ClientScript.RegisterStartupScript the control is added in the
> footer of the page.
>
> In what way i can resolve this issue?
>
> thanx
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How to create a rule in which all email with a specific subject line causes message to have specific color Diane Poremsky [MVP] Microsoft Outlook Discussion 0 13th Oct 2009 09:46 PM
Generated JavaScript vs. Manually Created JavaScript: Which one comes first? Nathan Sokalski Microsoft ASP .NET 4 8th Nov 2007 07:24 AM
How to fire Javascript events from a .NET winforms user control back to Javascript in IE jonathan.beckett Microsoft Dot NET 0 13th Jul 2006 02:51 PM
application/x-javascript vs. text/javascript. Peter Rilling Microsoft ASP .NET 1 14th Mar 2004 03:41 PM
Javascript:void(null); or Javascript:; -problem clicking certain js action items chribjor Windows XP Internet Explorer 1 21st Jan 2004 11:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:25 AM.