Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
ASP.NET 2.0 / 3.5 / 4.0
Menu dinamico - sessioni - placeholder...HELP
venerdì 04 luglio 2008 - 17.14
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
stuzzo
Profilo
| Junior Member
133
messaggi | Data Invio:
ven 4 lug 2008 - 17:14
Salve a tutti!
ho un problemino da cui non riesco ad uscire......o forse non mi rendo conto di cosa devo fare :)
Sto creandomi un sito che ha sulla sinistra un menù. Questo menù in base se si è loggati o meno deve cambiare o meglio se si è loggati questo menù viene arricchito di altre voci, ma il resto è tutto uguale.
Adesso cosa mi consigliate di fare??
Visto che si trova all'interno di un content placeholder:
- dovrei soltanto rendere invisibili le voci e nel caso si è loggati renderle visibili? oppure
- dire al content di andarsi a caricare un altro menù? oppure
- crearmi un menù dinamico che se si è loggati aggiunge delle voci? (questa mi sembra più sensata, ma non ho idea di come fare)
Vi ringrazio anticipatamente di tutto!
Mikyct86
Profilo
| Junior Member
81
messaggi | Data Invio:
ven 4 lug 2008 - 17:31
Allora l'ultima è la piu sensata!
Crei un Menu e ti basta aggiungere al login una variabile di sessione tipo session("ClientId")=1
alla creazione del Menu dove crei le voci basta dire che Se session("ClientId") > 0 crei le voci nuove!
Ciao,
«Due cose sono infinite: l'universo e la stupidità umana, ma riguardo l'universo ho ancora dei dubbi.» A.E.
Michele Crimi - Programmatore .Net
stuzzo
Profilo
| Junior Member
133
messaggi | Data Invio:
ven 4 lug 2008 - 17:38
Ti ringrazio,
riusciresti a postarmi un pezzetto di codice di come creare il menu?
Grazie mille ancora
Mikyct86
Profilo
| Junior Member
81
messaggi | Data Invio:
ven 4 lug 2008 - 18:06
Io ho un menu creato da una Stored Procedure fatto tempo fa...Vedi se ti puo aiutare!
questo script creava un controllo di tipo menu... se hai dubbi non esitare a contattarmi!
Public Sub CreaMenu()
Dim menu1 As New Menu
menu1.Items.Clear()
Dim FatherItem As New MenuItem
Dim ChildItem As New MenuItem
Dim dr As DataRow
Dim CatName As String
Dim ProdName As String
Dim prod As Integer
Dim cat As Integer
Dim discTemp As Integer
Dim i As Integer
Dim altezza As Integer = 0
Dim dtaEventType As DataTable = DataInterface.DBCategorie.cp_GetCategorieAndProdotti
For Each dr In dtaEventType.Rows
ChildItem = New MenuItem
cat = dtaEventType.Rows.Item(i).Item(2)
prod = dtaEventType.Rows.Item(i).Item(3)
CatName = dtaEventType.Rows.Item(i).Item(0)
'maiuscolo
CatName = CatName.ToUpper()
ProdName = dtaEventType.Rows.Item(i).Item(1)
ProdName = GetEventTextAbbreviation(ProdName)
'se non è il primo
If i > 0 Then
'il precedente
discTemp = dtaEventType.Rows.Item(i - 1).Item(2)
Else
altezza += 30
FatherItem = New MenuItem
'se è il primo
With FatherItem
.Text = CatName & "(" & dtaEventType.Rows.Item(i).Item(4) & ")"
.Value = cat
.NavigateUrl = "../Products.aspx?CategoriaID=" & cat & "&ProdottoID=-1&bShowAll=1"
End With
With ChildItem
.Text = ProdName
.Value = prod
.NavigateUrl = "../Products.aspx?CategoriaID=" & cat & "&ProdottoID=" & prod & "&bShowAll=1"
End With
'A seconda se è loggato inserisco il child Item
if session("lClientID")>0 then
FatherItem.ChildItems.Add(ChildItem)
end if
With menu1
.Items.Add(FatherItem)
End With
End If
If i > 0 Then
If discTemp <> cat Then
FatherItem = New MenuItem
With FatherItem
.Text = CatName & "(" & dtaEventType.Rows.Item(i).Item(4) & ")"
.Value = cat
.NavigateUrl = "../Products.aspx?CategoriaID=" & cat & "&ProdottoID=-1&bShowAll=1"
End With
With ChildItem
.Text = ProdName
.Value = prod
.NavigateUrl = "../Products.aspx?CategoriaID=" & cat & "&ProdottoID=" & prod & "&bShowAll=1"
End With
FatherItem.ChildItems.Add(ChildItem)
altezza += 30
With menu1
.Items.Add(FatherItem)
End With
Else
With ChildItem
.Text = ProdName
.Value = prod
.ToolTip = ProdName
.NavigateUrl = "../Products.aspx?CategoriaID=" & cat & "&ProdottoID=" & prod & "&bShowAll=1"
End With
FatherItem.ChildItems.Add(ChildItem)
End If
End If
i += 1
Next
With menu1
.DynamicMenuItemStyle.CssClass = "lTop2"
.Height = Unit.Pixel(altezza)
.Width = Unit.Pixel(100)
.StaticMenuItemStyle.CssClass = "lMenu2"
.StaticSubMenuIndent = Unit.Pixel(30)
.DynamicVerticalOffset = 0
End With
UpdatePanel1.Controls.Add(menu1)
End Sub
Ciao,
«Due cose sono infinite: l'universo e la stupidità umana, ma riguardo l'universo ho ancora dei dubbi.» A.E.
Michele Crimi - Programmatore .Net
sankyu
Profilo
| Senior Member
266
messaggi | Data Invio:
sab 5 lug 2008 - 00:19
Potresti anche usare gli oggetti autentication di asp.net che fai prima !!!
leggiti:
http://dotnethell.it/articles/Membership-Role-Profile-Provider.aspx
e poi anche info sulla loginview che è il componente che serve a te!
http://msdn.microsoft.com/it-it/library/system.web.ui.webcontrols.loginview.aspx
perchè sbattersi quando ms ha gia fatto il lavoro!!
oppure puoi creare dei menu usando il db ma è un lavoraccio!
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !