Partial Class Anagrafica_UI_Anagrafe_AnagrafeAJAX
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
......
If Not IsPostBack Then 'aggiunta per evitare il postback
......
CreaTab(anagrafica)
...
end If
.......
End Sub
Protected Sub HandleContextClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeViewContextMenuEventArgs) Handles RadTreeView1.ContextMenuItemClick
Dim contextCommand As String = e.MenuItem.Text
Dim currentNode As RadTreeNode = e.Node
Dim currentID As String = e.MenuItem.Value
' '' ''devo creare un nuovo oggetto radice nell'albero
Dim profilo As ProfiloUtente
profilo = Session("profiloUtente")
Select Case currentID
Case "1"
'apri nodo selezionato
If Not IsNothing(currentNode) Then
........
riempicontent(anagrafica)
CreaTab(anagrafica, False)
End If
End Select
End Sub 'HandleContextClick
Protected Sub CreaTab(ByVal ana As EBMAnagrafica, Optional ByVal editable As Boolean = False)
Dim database As dbManager = Utility.GetDbManager(False)
Dim gruppo As New GestioneAnagrafe.Enterprise.EBCRaggruppamento(database)
Dim oggettogruppo As New EBMRaggruppo
oggettogruppo = gruppo.read(ana.IdTipoOggetto, ana.DataInizio, ana.DataFine, Session("ci").ToString(), Session("ba").ToString(), Session("cliente").ToString(), Session("id_lingua").ToString()) 'leggo raggruppamenti
'INIZIALIZZO LA TABSTRIP
Dim TabStrip As New RadTabStrip
'creazione delle tab strip per categorie di raggruppamento nomi campi
TabStrip = Me.inf_webtab_anagrafe
'PULISCO IL TAB
If (TabStrip.Tabs.Count <> 0) Then
TabStrip.Tabs.Clear()
End If
pulisci("MultiPage")
Dim listagruppo As New ArrayList
listagruppo = oggettogruppo.ListaCat
Session("OggettoAttributi") = oggettogruppo
'Creazione della Tabstrip con i nomi categoria
If listagruppo.Count = 0 Then
Session("ArrayDinamici") = arrControlliDinamici
End If
'aggiungo primo tab dei raggruppamenti se c'รจ
For i As Integer = 0 To listagruppo.Count - 1
AddTab(Split(listagruppo(i), ";")(0), Split(listagruppo(i), ";")(1))
If (i = 0) Then
AddPageView(Split(listagruppo(0), ";")(1), ana)
End If
Next
'TabStrip.SelectedIndex = 0
'AGGIUNGO TAB IMMAGINI
AddTab(Resources.Messaggi.tabImmagini, "IMM")
'AGGIUNGO TAB DOCUMENTI
AddTab(Resources.Messaggi.tabDocumenti, "DOC")
'quando ci clicco AddPageView("DOC", ana)
'AGGIUNGO TAB PLANIMETRIACARTOGRAFIA
AddTab(Resources.Messaggi.tabPlanimetrie, "PLANCART")
'quando ci clicco AddPageView("PLANCART", ana)
'Dim tab2 As Infragistics.WebUI.UltraWebTab.Tab = New Infragistics.WebUI.UltraWebTab.Tab()
End Sub
Private Sub CreaPannelloInfra(ByVal ana As EBMAnagrafica, ByVal oggettogruppo As EBMRaggruppo, ByVal idtab As String, ByVal pagev As RadPageView, ByVal editable As Boolean)
'Devo visualizzare gli attributi di un tipo e non dell'altro
Try
Dim booledit As Boolean
If (Boolean.TryParse(Me.hdEdit.Value.ToString(), booledit)) Then
If (booledit) Then
editable = True
End If
End If
Dim valoreattributoImmFatturazione As String
'recupero gli attributi per quell'oggettoa
Dim listagruppi As New ArrayList
Dim contacontrolli As Integer
'recupero label dei nomi campo
Dim listaLabel As New ArrayList
Dim listacampi As New ArrayList
'Etichetta di nome campo valorizzato
Dim etichetta As String
Dim recuperocodice As String = "" 'valorizzata con tabella recupero codice
Dim iddominioattributo As String ' da passare alla creazione di un nuovo attributo
Dim textddl As String 'da passre alla creazione di un nuovo attributo come testo di della combo
Dim valueddl As String 'da passere alla creazione di un nuovo attributo come valore della combo
'cerco la lista dei campi per ogni categoria
listagruppi = oggettogruppo.ListaCampi
For Each val As GruppoCampi In listagruppi
'PER OGNI RAGGRUPPAMENTO PRENDO LA LISTA DEI NOMI CAMPI ASSOCIATI
If val.Categoria = idtab Then
'controlla se la categoria \u00E8 uguale a quella del bottone clickato
listacampi = val.ListaNomiCampo() 'listanomi campo nomecampo;flag_gestione
Exit For
End If
Next
'crea pannello per tab
Dim newPanel As New Panel
newPanel.ID = "Pan" & idtab
newPanel.Visible = True
newPanel.CssClass = "radmultipageclass"
newPanel.Height = pagev.Height
'creo gli attributi per categoria
'creo label contenente etichetta e contenente valore
Dim tableAtt As New Table
tableAtt.Width = newPanel.Width
tableAtt.CellPadding = 0
tableAtt.CellSpacing = 0
tableAtt.ID = "T" & newPanel.ID
tableAtt.CssClass = "textoNormal"
Dim rcampiobbligatori As New TableRow
rcampiobbligatori.CssClass = "textoNormal"
Dim cellobbligatori As New TableCell 'cella con la scritta campi obbligatori
cellobbligatori.Text = Resources.Messaggi.CampiObbligatori
cellobbligatori.ColumnSpan = "6"
rcampiobbligatori.Cells.Add(cellobbligatori)
tableAtt.Rows.Add(rcampiobbligatori)
Dim rintestazione As New TableRow
rintestazione.CssClass = "textoNormal"
Dim cell2int As New TableCell
Dim cell5int As New TableCell
Dim cell6int As New TableCell
Dim cellint1 As New TableCell
Dim cellimg2 As New TableCell
cellint1.Text = "" 'Etichetta
.....
rintestazione.Cells.Add(cellint1)
rintestazione.Cells.Add(cell2int)
....
tableAtt.Rows.Add(rintestazione) 'riga intestazione delle colonne
For count As Integer = 0 To valoreAttributo.Length - 1
........
labelValore = textvalore 'label contenente valore attributo
labelValore.ID = "LBVA" & listacampi(i) & ";" & count
labelValore.Text = CType(valoreAttributo(count), String) 'valore dell'etichetta
labelValore.Width = dimTextAttributi
cell2.Controls.Add(labelValore)
riga.Cells.Add(cell1) 'Etichetta Attributo
riga.Cells.Add(cell2) 'valore attributo
riga.Cells.Add(cell5) 'data Inizio
riga.Cells.Add(cell6) 'data Fine
If (dominioattributo.tipo_Rappresentazione_Grafica.ToLower <> "shape") Then
tableAtt.Rows.Add(riga) 'Aggiungo riga alla tabella
End If
......
Next
pagev.Controls.Add(newPanel) ' aggiungo il pannello al controllo multipage della tab
.......
End Sub
Private Sub AddTab(ByVal tabName As String, ByVal tabValue As String)
Dim tab As RadTab = New RadTab
tab.Text = tabName
tab.Value = tabValue
If (tabValue = "PLANCART") Then
tab.Width = 200
Else
tab.Width = 90
End If
Me.inf_webtab_anagrafe.Tabs.Add(tab)
End Sub
Private Sub AddPageView(ByVal tabVALUE As String, ByVal ana As EBMAnagrafica)
Dim TAB As RadTab = Me.inf_webtab_anagrafe.FindTabByValue(tabVALUE)
If (Not IsNothing(TAB) And Not IsNothing(ana)) Then
Select Case tabVALUE
Case "IMM"
Dim pageView0 As New RadPageView
pageView0.ID = TAB.Value '"Page" & tab0.Value
'pageView0.CssClass = "MultiPage"
pageView0.Height = RadMultiPage1.Height
pageView0.Width = RadMultiPage1.Width
pageView0.ContentUrl = "ImmagineAnagrafe.aspx?UID=" & ana.Uid
TAB.PageViewID = pageView0.ID
RadMultiPage1.PageViews.Add(pageView0)
Case "DOC"
Dim pageView2 As New RadPageView
pageView2.ID = TAB.Value '"Page" & tab0.Value
' pageView2.CssClass = "MultiPage"
pageView2.Width = RadMultiPage1.Width
pageView2.Height = RadMultiPage1.Height
pageView2.ContentUrl = "Documenti.aspx?UID=" & ana.Uid
TAB.PageViewID = pageView2.ID
RadMultiPage1.PageViews.Add(pageView2)
Case "PLANCART"
Dim nodo As String
''ADD SILVIA 7/12 aggiunto nome tabella in fondo al value per umpi altrimenti dopo non trova dwg
nodo = "false@" & ana.UidPadre & "@" & ana.DataInizio & "@" & ana.DataFine & "@" & ana.Uid & "@" & ana.IdTipoOggetto & "@" & ana.Nome_tabella
Dim pageView1 As New RadPageView
pageView1.ID = TAB.Value
' pageView1.CssClass = "MultiPage"
pageView1.Height = RadMultiPage1.Height
pageView1.Width = RadMultiPage1.Width
If (System.Configuration.ConfigurationManager.AppSettings("AbilitaCartografia").ToString() <> "1") Then
'//cartografia non abilitata
Dim lcart As New Label
lcart.Text = Resources.Messaggi.msgNoAbilitaCartografia
pageView1.Controls.Add(lcart)
Else
pageView1.ContentUrl = "Cartografia.aspx?nodo=" & nodo & "&dv=" & DateTime.Parse(Me.txtDataVisita.Text.ToString()).ToShortDateString()
End If
TAB.PageViewID = pageView1.ID
RadMultiPage1.PageViews.Add(pageView1)
Case Else
Dim oggettogruppo As EBMRaggruppo = CType(Session("OggettoAttributi"), EBMRaggruppo)
AddPageViewAttributi(TAB.Value, ana, oggettogruppo, editabileglobal)
End Select
End If
End Sub
Private Sub AddPageViewAttributi(ByVal tabVALUE As String, ByVal ana As EBMAnagrafica, ByVal raggruppo As EBMRaggruppo, ByVal editable As Boolean)
Me.RadMultiPage1.Height = Me.altPannelloAttributi
Dim TAB As RadTab = Me.inf_webtab_anagrafe.FindTabByValue(tabVALUE)
If (Not IsNothing(TAB) And Not IsNothing(ana)) Then
Dim pageView2 As New RadPageView
pageView2.ID = TAB.Value '"Page" & tab0.Value
pageView2.Width = RadMultiPage1.Width
pageView2.Height = RadMultiPage1.Height
' CreaPannelloInfra(ana, raggruppo, TAB.Value, pageView2, editable)
TAB.PageViewID = pageView2.ID
RadMultiPage1.PageViews.Add(pageView2)
End If
End Sub
Protected Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadMultiPageEventArgs) Handles RadMultiPage1.PageViewCreated
Dim ana As EBMAnagrafica = CType(Session("Oggetto"), EBMAnagrafica)
Select Case e.PageView.ID
Case "IMM"
e.PageView.ContentUrl = "ImmagineAnagrafe.aspx?UID=" & ana.Uid
Case "DOC"
e.PageView.ContentUrl = "Documenti.aspx?UID=" & ana.Uid
Case "PLANCART"
Dim nodo As String
''ADD SILVIA 7/12 aggiunto nome tabella in fondo al value per umpi altrimenti dopo non trova dwg
nodo = "false@" & ana.UidPadre & "@" & ana.DataInizio & "@" & ana.DataFine & "@" & ana.Uid & "@" & ana.IdTipoOggetto & "@" & ana.Nome_tabella
If (System.Configuration.ConfigurationManager.AppSettings("AbilitaCartografia").ToString() <> "1") Then
'//cartografia non abilitata
Dim lcart As New Label
lcart.Text = Resources.Messaggi.msgNoAbilitaCartografia
e.PageView.Controls.Add(lcart)
Else
e.PageView.ContentUrl = "Cartografia.aspx?nodo=" & nodo & "&dv=" & DateTime.Parse(Me.txtDataVisita.Text.ToString()).ToShortDateString()
End If
Case Else
Dim oggettogruppo As EBMRaggruppo = CType(Session("OggettoAttributi"), EBMRaggruppo)
CreaPannelloInfra(ana, oggettogruppo, e.PageView.ID, e.PageView, editabileglobal)
End Select
End Sub
Protected Sub inf_webtab_anagrafe_TabClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTabStripEventArgs) Handles inf_webtab_anagrafe.TabClick
Dim ana As EBMAnagrafica = CType(Session("Oggetto"), EBMAnagrafica)
Dim trovato As Boolean = False
For Each pagev As RadPageView In RadMultiPage1.PageViews
If (pagev.ID = e.Tab.Value) Then
' Dim oggettogruppo As EBMRaggruppo = CType(Session("OggettoAttributi"), EBMRaggruppo)
trovato = True
' If (e.Tab.Value <> "IMM" And e.Tab.Value <> "DOC" And e.Tab.Value <> "PLANCART") Then
' ' CreaPannelloInfra(ana, oggettogruppo, pagev.ID, pagev, editabileglobal)
' End If
End If
Next
If (Not trovato) Then
AddPageView(e.Tab.Value, ana)
End If
e.Tab.PageView.Selected = True
e.Tab.SelectedIndex = e.Tab.Index
End Sub
Protected Sub imgEdit_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgEdit.Click
Me.hdEdit.Value = "true"
.....
CreaTab(Session("Oggetto"), True)
.....
End If
End Sub
End Class
imgEdit_Click) for rendering controls (textbox ) in the pageview del tabstrip editable,
the first tab contains editable controls but when I change the tab, controls returns not editable. I tried to set a hidden field to true (Me.hdEdit.Value = "true"
) when it should become editable control, but once you change this value tab changes back, as if it is a reload of the page. How can I do?