Help: using RegisterClientScriptBlock #2

Discussion in 'ASP .Net' started by Mark, Oct 17, 2003.

  1. Mark

    Mark Guest

    I'm really pulling my hair out on this. (newbie at ASP.NET)

    I have a control (called 'header.ascx' ) that I want to place a
    DHTML(javascript) menu in. I keep getting errors.

    The menu code is in 2 .js files (adds/menu/wm_code.js, and
    adds/menu/wm_menu.js).
    When written with html this snippet:
    <script language="JavaScript1.2" src="adds/menu/wm_code.js"
    type="text/javascript"></script>
    goes in between my <head> and </head> tags. While this one:
    <script language="JavaScript1.2" src="adds/menu/wm_menu.js"
    type="text/javascript"></script>
    goes where I want the menu to appear.

    That works correctly.
    But I had a problem using 'refresh' in the brower (cue to frames) so I want
    to scrap the frames and use a web/user control.
    I have read (and didn't really understand) MS articles on using
    RegisterClienntScriptBlock.

    Herer is the code I have for the ascx file:

    <%@ Control Language="VB" %>
    <script runat="server">
    Sub Page_Load(sender as Object, e as EventArgs)

    this.RegisterClientScriptBlock("myScript","<script
    language="JavaScript1.2" src="adds/menu/wm_menu.js"
    type="text/javascript"></script>");

    End Sub


    </script>
    <p align="center">
    <table height="90" width="100%" align="center" bgcolor="dodgerblue">
    <tbody>
    <tr>
    <td rowspan="3">
    <p align="left">
    <asp:Image id="logo" runat="server"
    ImageUrl="images/logo_wm.gif" ImageAlign="Top"></asp:Image>
    </p>
    </td>
    <td valign="center" align="left" width="50%" colspan="2"
    height="50" border="0">
    </td>
    </tr>
    HERE IS WHERE i WANT THE MENU!!!!!!!!!!!!!!!!!!!!!!!!!!
    <tr>
    <td valign="center" width="50%" colspan="2" height="40"
    rowspan="2" border="0">
    <p align="center">
    <asp:AdRotator id="header" runat="server"
    Width="360px" Height="40px"
    AdvertisementFile="adds/headerads.xml"></asp:AdRotator>
    </p>
    </td>
    </tr>
    <tr>
    </tr>
    </tbody>
    </table>
    </p>

    I keep getting this error when viewed via IE:

    Name 'this' is not declared. (from line 5 in the above file.0
    What am I doing wrong and how can I get the menu to appear where I want it?
    (In caps in the above code)

    Thanks again,
    Mark
     
    Mark, Oct 17, 2003
    #1
    1. Advertising

  2. Mark

    Mark Guest

    Re: using RegisterClientScriptBlock #2

    I seem to have figured it out............

    Thanks anyway, please disregard... Unless you have any good tips! lol.....




    "Mark" <> wrote in message
    news:...
    > I'm really pulling my hair out on this. (newbie at ASP.NET)
    >
    > I have a control (called 'header.ascx' ) that I want to place a
    > DHTML(javascript) menu in. I keep getting errors.
    >
    > The menu code is in 2 .js files (adds/menu/wm_code.js, and
    > adds/menu/wm_menu.js).
    > When written with html this snippet:
    > <script language="JavaScript1.2" src="adds/menu/wm_code.js"
    > type="text/javascript"></script>
    > goes in between my <head> and </head> tags. While this one:
    > <script language="JavaScript1.2" src="adds/menu/wm_menu.js"
    > type="text/javascript"></script>
    > goes where I want the menu to appear.
    >
    > That works correctly.
    > But I had a problem using 'refresh' in the brower (cue to frames) so I

    want
    > to scrap the frames and use a web/user control.
    > I have read (and didn't really understand) MS articles on using
    > RegisterClienntScriptBlock.
    >
    > Herer is the code I have for the ascx file:
    >
    > <%@ Control Language="VB" %>
    > <script runat="server">
    > Sub Page_Load(sender as Object, e as EventArgs)
    >
    > this.RegisterClientScriptBlock("myScript","<script
    > language="JavaScript1.2" src="adds/menu/wm_menu.js"
    > type="text/javascript"></script>");
    >
    > End Sub
    >
    >
    > </script>
    > <p align="center">
    > <table height="90" width="100%" align="center" bgcolor="dodgerblue">
    > <tbody>
    > <tr>
    > <td rowspan="3">
    > <p align="left">
    > <asp:Image id="logo" runat="server"
    > ImageUrl="images/logo_wm.gif" ImageAlign="Top"></asp:Image>
    > </p>
    > </td>
    > <td valign="center" align="left" width="50%" colspan="2"
    > height="50" border="0">
    > </td>
    > </tr>
    > HERE IS WHERE i WANT THE MENU!!!!!!!!!!!!!!!!!!!!!!!!!!
    > <tr>
    > <td valign="center" width="50%" colspan="2" height="40"
    > rowspan="2" border="0">
    > <p align="center">
    > <asp:AdRotator id="header" runat="server"
    > Width="360px" Height="40px"
    > AdvertisementFile="adds/headerads.xml"></asp:AdRotator>
    > </p>
    > </td>
    > </tr>
    > <tr>
    > </tr>
    > </tbody>
    > </table>
    > </p>
    >
    > I keep getting this error when viewed via IE:
    >
    > Name 'this' is not declared. (from line 5 in the above file.0
    > What am I doing wrong and how can I get the menu to appear where I want

    it?
    > (In caps in the above code)
    >
    > Thanks again,
    > Mark
    >
    >
     
    Mark, Oct 17, 2003
    #2
    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. Brian W
    Replies:
    1
    Views:
    2,924
    Yan-Hong Huang[MSFT]
    Jul 4, 2003
  2. Steven K

    Error using RegisterClientScriptBlock

    Steven K, Apr 14, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    377
    =?Utf-8?B?QmluIFNvbmcsIE1DUA==?=
    Apr 14, 2004
  3. Big Dave
    Replies:
    0
    Views:
    2,320
    Big Dave
    Dec 2, 2004
  4. Steve Powell
    Replies:
    3
    Views:
    3,049
    Steve Powell
    Jun 21, 2005
  5. kewl
    Replies:
    2
    Views:
    2,187
    Bruce Barker
    Mar 14, 2006
Loading...

Share This Page