Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > I want to do a process once per page process, but 'touch' all instances of my server control.

Reply
Thread Tools

I want to do a process once per page process, but 'touch' all instances of my server control.

 
 
Jason Kendall
Guest
Posts: n/a
 
      06-01-2005
I have a server control that emits some client side script. Rather
than have a script block for every instance of my server control, I'd
like to have one block that contains the code for all of instances.

I have looked into the OnInit, OnLoad and OnPreRender events, but the
"MyBase.Page.Controls" collection never seems to contain my controls.

Any tips would be appreciated.


-Jason Kendall

 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      06-01-2005
Looks you have two different issues ?

Try IsClientScriptRegistered/RegisterClientScriptBlock. It allows to avoid
rendering the script if it has already been rendered previously...

For the second point you'll likely have to elaborate a bit...How do you look
at Page.Controls (your controls might be itself inside an inner control ?).
What if you start by looking at the HTML ? Do you see what your control is
supposed to render ? If should be a fairly good indication of wether or not
your control is actually in the control hierarchy...

Patrice


--

"Jason Kendall" <> a écrit dans le message de
news:...
> I have a server control that emits some client side script. Rather
> than have a script block for every instance of my server control, I'd
> like to have one block that contains the code for all of instances.
>
> I have looked into the OnInit, OnLoad and OnPreRender events, but the
> "MyBase.Page.Controls" collection never seems to contain my controls.
>
> Any tips would be appreciated.
>
>
> -Jason Kendall
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Button-click's client-side alert shows only once per page load, why? gnewsgroup ASP .Net 1 12-20-2007 04:41 PM
User Control with popup used more than once per page does not work lds ASP .Net 0 10-23-2007 02:27 PM
Defining FindControl Once Per Page MRW ASP .Net 0 08-21-2006 09:57 PM
Per-to-Per is OK but no ICS Jens Mander Wireless Networking 4 01-23-2005 10:24 PM
Should i select per device or per server to do all exercises? ADRENALINE MCSE 20 01-22-2004 09:20 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57