user3547022
user3547022

Reputation: 1

HTML,Asp.net and Javascript Menu not working

I have a menu.js file in solution, and a masterpage.aspx:

One of the codeblock of masterpage as follows

<body>
    <table id="table2" blah blah>
        <tr>
            <td valign="top">
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td><img id="img" blah blah />
                        <td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="height: 14px">
                 <%SelectJSMenu%>
            </td>
       </tr>
   </table>
</body>

In code behind masterpage.aspx.vb

  Public Sub SelectJSMenu()
  {
      Select Case System.Configration.ConfigurationManager.AppSettinges("stage")
          Case 1
             Response.Output.Write("script") 'loading menu.js file via script
          Case 2
             Response.Output.Write("scirpt") 'loading another menu2.js file via this script

  }

What I have to do is to check the user permission and write this menu if user is not who he claims to be, then load the second.

Upvotes: 0

Views: 92

Answers (2)

Ashutosh
Ashutosh

Reputation: 1060

Apart from an issue with the closing of the tag as mentioned in @j-p's answer, the following needs to be corrected.

Instead of

 Case 1
             Response.Output.Write("script") 'loading menu.js file via script
 Case 2
             Response.Output.Write("scirpt") 'loading another menu2.js file

do-

Case 1
             Response.Output.Write("<script src=\"menu.js\"></script>") //loading menu.js file via script
 Case 2
             Response.Output.Write("<script src=\"menu2.js\"></script>") //loading another menu2.js file via this script

Upvotes: 0

j-p
j-p

Reputation: 1632

I'm not expert in js and asp but reviewing your post, I think the problem is that you don't close your <td> tag in the second enclosed table:

_edit: there's some exception in html which allow tag omission, and < td> tag is part of them. But complex parser could have a more strict validation stage that could complain about it.

try replace:

                <tr>
                    <td><img id="img" blah blah />
                    <td>
                </tr>

by:

                <tr>
                    <td>
                        <img id="img" blah blah />
                    </td>
                </tr>

Upvotes: 1

Related Questions