question

fernandosalaburu-0532 avatar image
0 Votes"
fernandosalaburu-0532 asked fernandosalaburu-0532 edited

put security to dropdown menu

good!! I have a drop down menu

  <div id="topnav">
       <ul>
         <li class="active"><a href="PageLogin.aspx">Acceso</a></li>
         <li><a href="#" >Style Demo</a></li>
         <li><a href="#">Full Width</a></li>
         <li><a href="#">Seguridad</a>
           <ul>
             <li><a href="PageAltaEmpleado.aspx">Alta de Usuario</a></li>
             <li><a href="PageBuscaUsuario.aspx">Busca Usuarios</a></li>
             <li><a href="PagePuertas.aspx">Puertas ABM</a></li>
             <li><a href="PageAdmPuertas.aspx">Administra Puerta</a></li>
             <li><a href="PageUsuarios.aspx">prueba</a></li>
             <li><a href="PageAccesos.aspx">Administra Accesos</a></li>
             <li><a href="PageAutocompletado.aspx">Autocompletado </a></li>
             <li><a href="#">Link 8</a></li>
             <li><a href="#">Link 9</a></li>
             <li><a href="#">Link 10</a></li>
             <li><a href="#">Link 11</a></li>
             <li><a href="#">Link 12</a></li>
             <li><a href="#">Link 13</a></li>
    
           </ul>
         </li>
         <li class="last" ><a href="#">A Long Link Text</a></li>
           <asp:Label ID="MuestraFecha" runat="server"></asp:Label>
       </ul>
     </div>



by SQL I bring the security of the doors that the user can see

 DataTable access = (DataTable)Session["MyAccess"];

return this result

113049-image.png



I would like to know if the item (<li> <a href="#"> Link 8 </a> </li>) can be given the code (example 2055) and then buy it with what I bring from the database and I save it in the session variable, and then this line, remove it, enable, disable, with javascript or somehow ???

de esta manera el usuario no podra acceder a esa linea del menu desplegable o no la ve.




dotnet-aspnet-generaldotnet-aspnet-webformsdotnet-aspnet-webpages
image.png (1.3 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @fernandosalaburu-0532 ,

I would like to know if the item (<li> <a href="#"> Link 8 </a> </li>) can be given the code (example 2055) and then buy it with what I bring from the database and I save it in the session variable, and then this line, remove it, enable, disable, with javascript or somehow ???

I don't understand your requirement clearly.Could you tell more details of your requirement clearly?
Best regards,
Yijing Sun

0 Votes 0 ·

My intention is that the line <li> can be hidden, disabled, not selected, <li> if it can allow me to buy what is from each line against what comes from the session table variable

0 Votes 0 ·

I was able to solve it, thank you very much

0 Votes 0 ·

1 Answer

fernandosalaburu-0532 avatar image
0 Votes"
fernandosalaburu-0532 answered fernandosalaburu-0532 edited

there I found a solution


in the drop-down menu I put


 <div id="topnav">
       <ul>
         <li class="active"><a href="#">Home</a></li>
         <li><a id="A2047" runat="server" href="WebForm2.aspx">PUERTAS</a></li>
         <li><a id="A2048" runat="server" href="#">URUARIO</a></li>
         <li><a id="A2049" runat="server" href="#">SEGURIDAD</a>
           <ul>
             <li><a id="A2050" runat="server" href="#">Link 1</a></li>
             <li><a id="A2051" runat="server" href="#">Link 2</a></li>
             <li><a id="A2052" runat="server" href="#">Link 3</a></li>
           </ul>

then the code looked for the menu item and took it out

Page_Load

             A2047.Visible = false;
             A2048.Visible = false;
             A2049.Visible = false;

then with the accesses that the user can see, I visualize them

  DataTable access = (DataTable)Session["MyAccess"];
    
 //esto recorre la tabla (Datatable) 
    
             for (int i = 0; i < access.Rows.Count; i++)
             {
                 string door = access.Rows[i]["D_NO"].ToString();
    
                 if (door == "2049")
                 {
                     A2049.Visible = true;
      
                 }
              }



or it can also be done by Css


  //A2049.Attributes["class"] = "yourCssClass"; 








5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.