|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
I want to do a process once per page process, but 'touch' all instances of my server control.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 JasonKend***@hotmail.com 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 -- Show quoteHide quote"Jason Kendall" <JasonKend***@hotmail.com> a écrit dans le message de news:u11s91h0b0hcv1kiot2ona9j4m48jga76f@4ax.com... > 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 > JasonKend***@hotmail.com
SRE (Simple Rule Engine)
Error: Cannot use a leading .. to exit above the top directory. DROPDOWNLIST SELECTEDINDEXCHANGED Drop down listbox - extra properties, possible? how to capture click event in aspx from placeholder ->control order of usercontrols processed by events of page ASP.NET Server Controls not displayed in IE How do I create an Unordered List (UL) with ASP.NET? Control opens over another Problem with AutoPostback and DropDownlist / Multipage |
|||||||||||||||||||||||