registering javascript

Discussion in 'ASP .Net Web Controls' started by Timothy Elvidge, Jul 15, 2004.

  1. I have a menu control that is embedded in each web page. The menu requires javascript for the mouseover events. I have tried Page.RegisterClientScriptBlock and
    Page.RegisterStartupScript to no avail. The script doesn't appear on the parent page?? What to do?
    Timothy Elvidge, Jul 15, 2004
    #1
    1. Advertising

  2. Timothy Elvidge

    XicoLoKo Guest

    When do you call the Page.RegisterClientScriptBlock?
    What key are you using to uniquely identify each script?

    "Timothy Elvidge" wrote:

    > I have a menu control that is embedded in each web page. The menu requires javascript for the mouseover events. I have tried Page.RegisterClientScriptBlock and
    > Page.RegisterStartupScript to no avail. The script doesn't appear on the parent page?? What to do?
    XicoLoKo, Jul 15, 2004
    #2
    1. Advertising

  3. Timothy Elvidge

    Teemu Keiski Guest

    To add to this that registering needs to happen in OnPreRender at the
    latest. In Render it is too late because render process has begun for the
    Page already.


    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist
    http://blogs.aspadvice.com/joteke



    "XicoLoKo" <> wrote in message
    news:...
    > When do you call the Page.RegisterClientScriptBlock?
    > What key are you using to uniquely identify each script?
    >
    > "Timothy Elvidge" wrote:
    >
    > > I have a menu control that is embedded in each web page. The menu

    requires javascript for the mouseover events. I have tried
    Page.RegisterClientScriptBlock and
    > > Page.RegisterStartupScript to no avail. The script doesn't appear on the

    parent page?? What to do?
    Teemu Keiski, Jul 15, 2004
    #3
  4. Timothy Elvidge

    Mr. Dot Net Guest

    Is it possible that you use output cache for that control?

    "Timothy Elvidge" <> wrote in
    message news:...
    > I have a menu control that is embedded in each web page. The menu requires

    javascript for the mouseover events. I have tried
    Page.RegisterClientScriptBlock and
    > Page.RegisterStartupScript to no avail. The script doesn't appear on the

    parent page?? What to do?
    Mr. Dot Net, Jul 15, 2004
    #4
  5. I have moved the following to the parent page for the menu control and I still can't see the Javascript appearing. This is what I am doing:-
    protected override void OnPreRender (System.EventArgs e)
    {
    Page.RegisterClientScriptBlock ("menuscript", "<script language=\"javascript\" src=\"default.js\"></script>\n");
    }
    I can use the ControlAt and write the script block as a literal control but would like to do this the right way.


    "Teemu Keiski" wrote:

    > To add to this that registering needs to happen in OnPreRender at the
    > latest. In Render it is too late because render process has begun for the
    > Page already.
    >
    >
    > --
    > Teemu Keiski
    > MCP, Microsoft MVP (ASP.NET), AspInsiders member
    > ASP.NET Forum Moderator, AspAlliance Columnist
    > http://blogs.aspadvice.com/joteke
    >
    >
    >
    > "XicoLoKo" <> wrote in message
    > news:...
    > > When do you call the Page.RegisterClientScriptBlock?
    > > What key are you using to uniquely identify each script?
    > >
    > > "Timothy Elvidge" wrote:
    > >
    > > > I have a menu control that is embedded in each web page. The menu

    > requires javascript for the mouseover events. I have tried
    > Page.RegisterClientScriptBlock and
    > > > Page.RegisterStartupScript to no avail. The script doesn't appear on the

    > parent page?? What to do?
    >
    >
    >
    Timothy Elvidge, Jul 16, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kelly G.
    Replies:
    1
    Views:
    489
    Mark Alexander Bertenshaw
    Jan 9, 2004
  2. w r via .NET 247

    Registering Excel addin

    w r via .NET 247, May 22, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    702
    w r via .NET 247
    May 22, 2004
  3. =?Utf-8?B?Q2hhcmxlc0E=?=

    Registering javascript via the Page object, why?

    =?Utf-8?B?Q2hhcmxlc0E=?=, May 15, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,413
    Marina Levit [MVP]
    May 15, 2006
  4. Juan T. Llibre
    Replies:
    2
    Views:
    3,901
    =?Utf-8?B?UmljaA==?=
    Dec 16, 2006
  5. Timothy Elvidge

    Registering javascript

    Timothy Elvidge, Jul 15, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    120
    Timothy Elvidge
    Jul 15, 2004
Loading...

Share This Page