|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Page.RegisterClientScriptBlock() is not working ..... :-(I am writing a WebControl. With that I need to emit JavaScript code on the page. For that I am using "Page.RegisterClientScriptBlock" method inside the PreRender event. It is shocking to see that the the method takes the script to emit, but does not actually emit it on the page. Neither it throws any exception. I am emiting JavaScript from 2 places: PreRender event and Render event. In PreRender, I am using Page.RegisterClientScriptBlock() and In Render I am using output.Write(). It could be noticed that output.Write() is working, but Page.RegisterClientScriptBlock() is not. What might be the reason? Any Help ? Thanks, ** Vipul ; PS: Also to note, RegisterStartupScript() is working from PreRender. ======================================= VIPUL PATHAK Impetus Infotech India Pvt. Limited, Indore, MP, India. Did you look at the HTML source of the rendered page to make sure it's not
being emitted? Did you wrap your javascript with <script language=javascript></script>? PreRender should be fine for doing this. -Brock DevelopMentor http://staff.develop.com/ballen Show quoteHide quote > Hi, > > I am writing a WebControl. With that I need to emit JavaScript code on > the page. For that I am using "Page.RegisterClientScriptBlock" method > inside the PreRender event. It is shocking to see that the the method > takes the script to emit, but does not actually emit it on the page. > Neither it throws any exception. > > I am emiting JavaScript from 2 places: PreRender event and Render > event. In PreRender, I am using Page.RegisterClientScriptBlock() and > In Render I am using output.Write(). It could be noticed that > output.Write() is working, but Page.RegisterClientScriptBlock() is > not. > > What might be the reason? Any Help ? > > Thanks, > > ** Vipul ; > > PS: Also to note, RegisterStartupScript() is working from PreRender. > ======================================= > VIPUL PATHAK > Impetus Infotech India Pvt. Limited, > Indore, MP, India. Yes, I have done all that ...
** Vipul ; "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message language=javascript></script>?news:508870632495859957986000@msnews.microsoft.com... > Did you look at the HTML source of the rendered page to make sure it's not > being emitted? Did you wrap your javascript with <script Show quoteHide quote > PreRender should be fine for doing this. > > -Brock > DevelopMentor > http://staff.develop.com/ballen > > > > > Hi, > > > > I am writing a WebControl. With that I need to emit JavaScript code on > > the page. For that I am using "Page.RegisterClientScriptBlock" method > > inside the PreRender event. It is shocking to see that the the method > > takes the script to emit, but does not actually emit it on the page. > > Neither it throws any exception. > > > > I am emiting JavaScript from 2 places: PreRender event and Render > > event. In PreRender, I am using Page.RegisterClientScriptBlock() and > > In Render I am using output.Write(). It could be noticed that > > output.Write() is working, but Page.RegisterClientScriptBlock() is > > not. > > > > What might be the reason? Any Help ? > > > > Thanks, > > > > ** Vipul ; > > > > PS: Also to note, RegisterStartupScript() is working from PreRender. > > ======================================= > > VIPUL PATHAK > > Impetus Infotech India Pvt. Limited, > > Indore, MP, India. > > > I'd suggest building the smallest app you can where this doesn't work. When
I build a page that does as you suggest it works fine (RegisterClientScriptBlock in PreRender). -Brock DevelopMentor http://staff.develop.com/ballen Show quoteHide quote > Yes, I have done all that ... > > ** Vipul ; > > "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message > news:508870632495859957986000@msnews.microsoft.com... > >> Did you look at the HTML source of the rendered page to make sure >> it's not being emitted? Did you wrap your javascript with <script >> > language=javascript></script>? > >> PreRender should be fine for doing this. >> >> -Brock >> DevelopMentor >> http://staff.develop.com/ballen >>> Hi, >>> >>> I am writing a WebControl. With that I need to emit JavaScript code >>> on the page. For that I am using "Page.RegisterClientScriptBlock" >>> method inside the PreRender event. It is shocking to see that the >>> the method takes the script to emit, but does not actually emit it >>> on the page. Neither it throws any exception. >>> >>> I am emiting JavaScript from 2 places: PreRender event and Render >>> event. In PreRender, I am using Page.RegisterClientScriptBlock() and >>> In Render I am using output.Write(). It could be noticed that >>> output.Write() is working, but Page.RegisterClientScriptBlock() is >>> not. >>> >>> What might be the reason? Any Help ? >>> >>> Thanks, >>> >>> ** Vipul ; >>> >>> PS: Also to note, RegisterStartupScript() is working from PreRender. >>> ======================================= >>> VIPUL PATHAK >>> Impetus Infotech India Pvt. Limited, >>> Indore, MP, India.
Show quote
Hide quote
"Vipul Pathak" <vpat***@impetus.co.in> wrote in message Yes, we had this before. The reason is, I believe, you are registering the news:uxLZjXXRFHA.2132@TK2MSFTNGP14.phx.gbl... > Hi, > > I am writing a WebControl. With that I need to emit JavaScript code on the > page. For that I am using "Page.RegisterClientScriptBlock" method inside > the > PreRender event. It is shocking to see that the the method takes the > script > to emit, but does not actually emit it on the page. Neither it throws any > exception. > > I am emiting JavaScript from 2 places: PreRender event and Render event. > In > PreRender, I am using Page.RegisterClientScriptBlock() and In Render I am > using output.Write(). It could be noticed that output.Write() is working, > but Page.RegisterClientScriptBlock() is not. > > What might be the reason? Any Help ? > > Thanks, > > ** Vipul ; > > PS: Also to note, RegisterStartupScript() is working from PreRender. > ======================================= > VIPUL PATHAK > Impetus Infotech India Pvt. Limited, > Indore, MP, India. > > script too late. Try registering the script before PreRender is called...in a different event or method? Mythran
How Do I assign an ID to ListItem?
How do I access HTML controls from the code behind? DataList ERROR URGENT Developing .NET Custom Web Control for use in ASP & ASP.NET pages DataGrid Question - asp:Hyperlink how to calculate time Sorting problem in DataGrid How do you populate the Dropdown in IE Web Controls? Creating a 3 State Rollover Button Color Picker Control |
|||||||||||||||||||||||