Help: using RegisterClientScriptBlock #2

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    Help: using RegisterClientScriptBlock #2

    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(javascrip t) 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="JavaS cript1.2" src="adds/menu/wm_code.js"
    type="text/javascript"></script>
    goes in between my <head> and </head> tags. While this one:
    <script language="JavaS cript1.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
    RegisterCliennt ScriptBlock.

    Herer is the code I have for the ascx file:

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

    this.RegisterCl ientScriptBlock ("myScript","<s cript
    language="JavaS cript1.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="dodger blue">
    <tbody>
    <tr>
    <td rowspan="3">
    <p align="left">
    <asp:Image id="logo" runat="server"
    ImageUrl="image s/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:AdRotato r id="header" runat="server"
    Width="360px" Height="40px"
    AdvertisementFi le="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

    #2
    Re: using RegisterClientS criptBlock #2

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

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




    "Mark" <pyedubois@hotm ail.com> wrote in message
    news:voua4ofilu rn21@corp.super news.com...[color=blue]
    > 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(javascrip t) 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="JavaS cript1.2" src="adds/menu/wm_code.js"
    > type="text/javascript"></script>
    > goes in between my <head> and </head> tags. While this one:
    > <script language="JavaS cript1.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[/color]
    want[color=blue]
    > to scrap the frames and use a web/user control.
    > I have read (and didn't really understand) MS articles on using
    > RegisterCliennt ScriptBlock.
    >
    > Herer is the code I have for the ascx file:
    >
    > <%@ Control Language="VB" %>
    > <script runat="server">
    > Sub Page_Load(sende r as Object, e as EventArgs)
    >
    > this.RegisterCl ientScriptBlock ("myScript","<s cript
    > language="JavaS cript1.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="dodger blue">
    > <tbody>
    > <tr>
    > <td rowspan="3">
    > <p align="left">
    > <asp:Image id="logo" runat="server"
    > ImageUrl="image s/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:AdRotato r id="header" runat="server"
    > Width="360px" Height="40px"
    > AdvertisementFi le="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[/color]
    it?[color=blue]
    > (In caps in the above code)
    >
    > Thanks again,
    > Mark
    >
    >[/color]


    Comment

    Working...