Emitting Client Script

E

Ed Courtenay

I've got a very simple custom control that requires a small section of
JavaScript to function at the client - nothing out of the ordinary.

In the overridden RenderContents method of my custom control I check
whether the required client script block has been registered with
Page.ClientScript.IsClientScriptBlockRegistered() and if not, register
it with Page.ClientScript.RegisterClientScriptBlock()

If I place the custom control on a web form, the script gets injected
into the page as expected and works as it should.

If, however, the control is placed onto a Master page the script doesn't
get injected and therefore the control fails to work; why is this
behaving differently when the control is placed on a Master page, and
what do I have to do to get it to work?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top