Ciao
ho una pagina master con un controllo treeview che però mi dà errore......mentre se lo eseguo in pagina aspx normale con VB associato finziona tranquillamente........
vi posto il codice:
pagina VB:
codice:
Partial Public Class template
Inherits MasterPage
Dim temp As String
Dim cont As Integer
Protected Sub Menu_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim nodo As New TreeNode
NodoPrincipale(nodo, 1)
TreeView1.Nodes.Add(nodo)
nodo.Text = "MENU"
'nodo.Target = ""
TreeView1.CollapseAll()
TreeView1.Nodes(0).Expand()
' MsgBox.Show(Me.lbCodiceOrdine.ID.ToString(), Page)
End If
End Sub
Private Sub NodoPrincipale(ByVal nodo As TreeNode, ByVal codicePadre As Integer)
Try
Dim da As New OleDbDataAdapter
Dim ds As New DataSet
Dim strsql As String = "SELECT Collegamento, Titolo,codice,url,TARGET,images FROM MENU Where codicepadre='" + CStr(codicePadre) + "' ORDER BY Codice"
da = New OleDbDataAdapter(strsql, objdb)
da.Fill(ds, "menu")
'Dim Cmd As New OleDbCommand("SELECT Collegamento, Titolo,codice,url,TARGET,images FROM MENU Where codicepadre=@CodicePadre ORDER BY Codice", objdb)
'Cmd.CommandType = CommandType.Text
Dim dtable As DataTable = ds.Tables("menu")
'Dim currRows() As DataRow = dtable.Select(Nothing, Nothing, DataViewRowState.CurrentRows)
For Each rowTipo As DataRow In dtable.Select(Nothing, Nothing, DataViewRowState.CurrentRows)
Dim nodeTipo As System.Web.UI.WebControls.TreeNode = New System.Web.UI.WebControls.TreeNode
If IsDBNull((rowTipo("Url"))) Then
nodeTipo.NavigateUrl = ""
Else
nodeTipo.NavigateUrl = rowTipo("Url")
End If
If IsDBNull((rowTipo("TARGET"))) Then
nodeTipo.Target = "_self"
Else
nodeTipo.Target = rowTipo("TARGET")
End If
If IsDBNull((rowTipo("images"))) Then
nodeTipo.ImageUrl = ""
Else
nodeTipo.ImageUrl = rowTipo("images")
End If
nodeTipo.Text = rowTipo("Titolo")
If IsDBNull((rowTipo("collegamento"))) Then
temp = 0 + rowTipo("codice")
Else
temp = rowTipo("collegamento")
End If
nodeTipo.Value = temp
nodeTipo.ToolTip = rowTipo("codice")
nodo.ChildNodes.Add(nodeTipo)
If Not IsDBNull((rowTipo("collegamento"))) Then
NodoPrincipale(nodeTipo, temp)
End If
Next
Catch ex As Exception
End Try
End Sub
Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TreeView1.SelectedNodeChanged
If TreeView1.SelectedNode.Expanded.ToString() = True Then
TreeView1.SelectedNode.Collapse()
Else
TreeView1.SelectedNode.Expand()
End If
End Sub
End Class
pagina asp con controllo treeview
codice:
<table style="width: 208px" border="0">
<tr>
<td style="width: 204px">
<asp:TreeView ID="TreeView1" runat="server" Height="550px" Width="152px"
Font-Size="12pt"
style="font-family: 'Times New Roman', Times, serif;font-size: small"
ImageSet="Simple" OnSelectedNodeChanged="TreeView1_SelectedNodeChanged" BackColor="GhostWhite" Font-Names="Arial" Font-Strikeout="False" ForeColor="DimGray">
<selectednodestyle Font-Names="Arial" Font-Size="12pt" ForeColor="DimGray" />
<ParentNodeStyle Font-Names="Arial" Font-Underline="True" ForeColor="DimGray" />
<HoverNodeStyle BackColor="White" />
<NodeStyle BackColor="Transparent" />
</asp:TreeView>
</td>
</tr>
</table>
errore che mi viene
codice:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30456: 'TreeView1_SelectedNodeChanged' is not a member of 'ASP.template_master'.
Line 47: <tr>
Line 48: <td style="width: 204px">
Line 49: <asp:TreeView ID="TreeView1" runat="server" Height="550px" Width="152px"
Line 50: Font-Size="12pt"
Line 51: style="font-family: 'Times New Roman', Times, serif;font-size: small"
vi prego aiutatemi..........