Ver Mensaje Individual
  #4 (permalink)  
Antiguo 15/07/2009, 02:07
guillermoesteban
 
Fecha de Ingreso: mayo-2006
Mensajes: 178
Antigüedad: 18 años
Puntos: 3
Respuesta: menu desplegable dinamico

Yo lo tengo hecho para otro de dynamic drive:
http://www.dynamicdrive.com/dynamici...enu-bullet.htm

Te lo paso sencillo (también tengo código que lee desde SQL). La historia es contruir el código de esa web a traves de un literal

Codigo:

<HTML>
<HEAD>
<title>menu1</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
<link rel="stylesheet" type="text/css" href="menuvertical1.css" >
<script type="text/javascript" src="jquery-1.2.6.pack.js"></script>
<script type="text/javascript" src="ddaccordion.js"></script>
<script type="text/javascript">

ddaccordion.init({ //top level headers initialization
headerclass: "expandable", //Shared CSS class name of headers group that are expandable
contentclass: "categoryitems", //Shared CSS class name of contents group
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
animatedefault: false, //Should contents open by default be animated into view?
persiststate: false, //persist state of opened contents within browser session?
toggleclass: ["closeheader", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
//togglehtml: ["suffix", "rr", "ss"], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
togglehtml: ["prefix", "<img src='images1/plusgreen.gif' class='statusicon'/>", "<img src='images1/minusgreen.gif' class='statusicon'/>"], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
//do nothing
},
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
//do nothing
}
})
ddaccordion.init({ //2nd level headers initialization
headerclass: "subexpandable", //Shared CSS class name of sub headers group that are expandable
contentclass: "subcategoryitems", //Shared CSS class name of sub contents group
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
animatedefault: false, //Should contents open by default be animated into view?
persiststate: false, //persist state of opened contents within browser session?
toggleclass: ["opensubheader", "closedsubheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
//togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
/*togglehtml: ["prefix", " <img src='images/plus.gif'/> ", " <img src='images/minus.gif'/> "], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)*/
togglehtml: ["prefix", "<img src='images1/plusgreen.gif' class='statusiconsub'/>", "<img src='images1/minusgreen.gif' class='statusiconsub'/>"], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
//do nothing
},
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
//do nothing
}
})
</script>
</HEAD>
<body>

<form id="Form1" method="post" runat="server">
<div align="center">
<div class="arrowlistmenu">
<asp:Literal id="Literal1" runat="server"></asp:Literal>
</div>
<br>
<asp:button id="btnPosesion" runat="server" CssClass="miboton"></asp:button><BR><br>
<asp:LinkButton id="LinkButton1" runat="server" CssClass="milink">Finalizar aplicación</asp:LinkButton></div>
<BR><br>
</form>
</body>
</HTML>


Y en el codigo de atras:
Private Sub Page_Load(....) Handles MyBase.Load
If Not Page.IsPostBack Then
Literal1.Text = webmastermenu()
End If
End If
End Sub

Private Function webmastermenu() As String
webmastermenu = getelto(True, "Inicio", "Ir a pantalla inicial", "Ini_Webmaster_principal.aspx")

'1.- mensajes
webmastermenu += getelto(True, "Mensajes / Foros", "Acceso a escribir mensajes, bandeja entrada y bandeja salida", "")
webmastermenu += getelto(False, "Nuevo a master", "Escribir un mensaje nuevo a un Master", "/Mensajes/Mensajes_Nuevo.aspx?Modo=W")
webmastermenu += getelto(False, "Bandeja entrada", "Relación de mensajes que te han enviado otros usuarios", "/Mensajes/Mensajes_Bandeja_Entrada.aspx")
webmastermenu += getelto(False, "Bandeja salida", "Relación de mensajes enviados por ti a otros usuarios", "/Mensajes/Mensajes_Bandeja_Salida.aspx")
webmastermenu += getelto(False, "Acceso a Foros", "Acceso a los foros", "/Mensajes/foros.aspx")
webmastermenu += vbCrLf & "</ul>" 'cierre

'2.- Webmaster(2)
webmastermenu += getelto(True, "Gestión Colegios", "Acceso a los coles", "")
webmastermenu += getelto(False, "Listado centros", "Listado de todos los centros", "/Webmaster/lista_centros.aspx")
webmastermenu += getelto(False, "Opciones Aplicacion", "Opciones de comboBox, etc...", "/Webmaster/lista_opciones.aspx")
webmastermenu += getelto(False, "Listado tablas BD", "Listado de todas las tablas", "/webmaster/InfoTablas.aspx")
webmastermenu += getelto(False, "Listado errores", "", "/Webmaster/lista_errores.aspx")
webmastermenu += getelto(False, "SELECT...FROM", "", "/Webmaster/Select_From.aspx")
webmastermenu += vbCrLf & "</ul>" 'cierre

End Function


Private Function getelto(ByVal Espadre As Boolean, ByVal titulo As String, ByVal MiTooltip As String, ByVal url As String) As String

If Espadre = True Then
'padre
If url = "" Then
getelto = vbCrLf & vbCrLf & "<h3 class=""menuheader expandable"">" & titulo & "</h3>"
getelto += vbCrLf & "<ul class=""categoryitems"">"
Else
getelto = vbCrLf & "<a class=""menuheader"" target=""principal"" href=""" & url & """>" & titulo & "</a>"
End If
Else
'hijo
getelto += vbCrLf & "<li>"
getelto += "<a target=""principal"" title=""" & MiTooltip & """ href=""" & url & """>" & titulo & "</a>"
getelto += "</li>"
End If
End Function
Private Function geteltosub(ByVal Espadre As Boolean, ByVal titulo As String, ByVal MiTooltip As String, ByVal url As String) As String

If Espadre = True Then
'padre
geteltosub = vbCrLf & vbCrLf & "<li><a target=""principal"" title=""" & MiTooltip & """ href=""" & url & """ class=""subexpandable"">" & titulo & "</a></li>"
geteltosub += vbCrLf & "<ul class=""subcategoryitems"">"
Else
'hijo
geteltosub += vbCrLf & "<li>"
geteltosub += "<a target=""principal"" title=""" & MiTooltip & """ href=""" & url & """>" & titulo & "</a>"
geteltosub += "</li>"
End If
End Function