Click here to Skip to main content
15,894,343 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Retriving images from Db Pin
Michael Sync20-Nov-07 19:03
Michael Sync20-Nov-07 19:03 
AnswerRe: Retriving images from Db Pin
Abhijit Jana20-Nov-07 18:08
professionalAbhijit Jana20-Nov-07 18:08 
GeneralRe: Retriving images from Db Pin
N a v a n e e t h20-Nov-07 18:40
N a v a n e e t h20-Nov-07 18:40 
AnswerRe: Retriving images from Db Pin
N a v a n e e t h20-Nov-07 18:38
N a v a n e e t h20-Nov-07 18:38 
GeneralRe: Retriving images from Db Pin
Krishna Varadharajan20-Nov-07 19:19
Krishna Varadharajan20-Nov-07 19:19 
QuestionError in control Pin
netJP12L20-Nov-07 14:46
netJP12L20-Nov-07 14:46 
AnswerRe: Error in control Pin
Michael Sync20-Nov-07 17:50
Michael Sync20-Nov-07 17:50 
QuestionDynamic Menus using IHierarchicalDataSource Pin
neilbelfast20-Nov-07 12:08
neilbelfast20-Nov-07 12:08 
Hi Everyone,

I need help on my asp:menu which is bind to hierarchichal data source. It has no error but it's not displaying anything. This is my first time to use asp.net and I have spent a lot of time on this task. I know there are glitches in my classes and interfaces but just don't know what code I should write on it. Please help me. See discussion below.

Thanks,
Neil


I have a class called menuClass and class collection called menuCollection. menuCollection is populated correctly through a stored procedure. I could bind this to a datalist for testing purposes and it would display its content. The menuclass has String members menuid, parentid and title. The fourth member is a list type IList. Am not sure of the last member if it's necessary but based on my research it will be used for the GetChildren function.

To bind my menu item, I used the logic as follows:
dsView = New SQLDataSourceControlView(mnuTempItems)
mnuItems.DataSource = dsView.Select()
mnuItems.DataBind()

where mnuTempItems is an instance of class menuCollection.

See my other classes and interfaces needed for HierarchicalDataSource:


Imports System
Imports System.Collections
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Security.Permissions
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace DrinksWebSite.Menu

<aspnethostingpermission(securityaction.demand,
level:=aspnethostingpermissionlevel.minimal)> _
Public MustInherit Class SQLDataSourceControl
Inherits HierarchicalDataSourceControl

Public Sub New()
End Sub

' Return a strongly typed view for the current data source control.

Private view As SQLDataSourceControlView = Nothing

Protected Overloads Function GetHierarchicalView(ByVal viewPath
As Menu.MenuCollection) As HierarchicalDataSourceView
If view Is Nothing Then
view = New SQLDataSourceControlView(viewPath)
End If
Return view
End Function 'GetHierarchicalView

Protected Overrides Function CreateControlCollection() As ControlCollection
Return (New ControlCollection(Me))
End Function 'CreateControlCollection

End Class 'SQLDataSourceControl

' The SQLDataSourceControlView class encapsulates the
' capabilities of the FileSystemDataSource data source control.

Public Class SQLDataSourceControlView
Inherits HierarchicalDataSourceView

Private _sqlCollection As MenuCollection


Public Sub New(ByVal viewPath As MenuCollection)
_sqlCollection = viewPath
End Sub 'New


Public Overrides Function [Select]() As IHierarchicalEnumerable
Dim fshe As New HierarchicalData(_sqlCollection)
Dim fsi As menuClass

For Each fsi In fshe
fshe.Add(New HierarchicalDataElement(fsi))
Next fsi
Return fshe

End Function 'Select
End Class 'FileSystemDataSourceView


Public Class HierarchicalData
Inherits ArrayList
Implements IHierarchicalEnumerable

Private data As MenuCollection

Public Sub New(ByVal values As MenuCollection)
data = New MenuCollection
For Each value As menuClass In values
data.Add(New HierarchicalDataElement(value))
Next
End Sub

Public Overridable Function GetHierarchyData(ByVal
enumeratedItem As
Object) As IHierarchyData _
Implements IHierarchicalEnumerable.GetHierarchyData
Return CType(enumeratedItem, IHierarchyData)
End Function 'GetHierarchyData

End Class 'HierarchicalData


Public Class HierarchicalDataElement
Implements IHierarchyData
Public _data As menuClass = Nothing

Public Sub New(ByVal obj As menuClass)
_data = obj
End Sub 'New

Public Overrides Function ToString() As String
Return _data.title
End Function 'ToString

' IHierarchyData implementation.
Public Overridable ReadOnly Property HasChildren() As Boolean _
Implements IHierarchyData.HasChildren
Get
Dim children As Menu.MenuCollection
children = GetChildren()
Return children.Count > 0
End Get
End Property

' returns the title of the menu

Public Overridable ReadOnly Property Path() As String _
Implements IHierarchyData.Path
Get
Return ToString()
End Get
End Property

Public Overridable ReadOnly Property Item() As Object _
Implements IHierarchyData.Item
Get
Return _data
End Get
End Property

Public Overridable ReadOnly Property Type() As String _
Implements IHierarchyData.Type
Get
Return _data.GetType().ToString()
End Get
End Property

Public Overridable Function GetChildren() As
IHierarchicalEnumerable_
Implements IHierarchyData.GetChildren
Dim parentContainer As New HierarchicalData(_data.List)
Dim children As New MenuCollection
Dim objMenu As menuClass
For Each objMenu In parentContainer
children.Add(objMenu)
Next objMenu

Return children
End Function 'GetChildren


Public Overridable Function GetParent() As IHierarchyData _
Implements IHierarchyData.GetParent
Return New HierarchicalDataElement(_data)
End Function 'GetParent
End Class 'HierarchicalDataElement

End Namespace


Cheers,
Neil
QuestionEncryption password Pin
mehran.asg20-Nov-07 11:21
mehran.asg20-Nov-07 11:21 
AnswerRe: Encryption password Pin
Hesham Amin20-Nov-07 12:07
Hesham Amin20-Nov-07 12:07 
AnswerRe: Encryption password Pin
Michael Sync20-Nov-07 15:46
Michael Sync20-Nov-07 15:46 
AnswerRe: Encryption password Pin
John-ph20-Nov-07 18:51
John-ph20-Nov-07 18:51 
QuestionDeclarativeCatalogPart Pin
TheEagle20-Nov-07 10:35
TheEagle20-Nov-07 10:35 
QuestionGridview Printing Pin
danielleroy20-Nov-07 8:31
danielleroy20-Nov-07 8:31 
QuestionNeed help impersonating a user Pin
dalge20-Nov-07 5:23
dalge20-Nov-07 5:23 
GeneralRe: Need help impersonating a user Pin
dalge20-Nov-07 5:28
dalge20-Nov-07 5:28 
GeneralRe: Need help impersonating a user Pin
Pete O'Hanlon20-Nov-07 11:19
mvePete O'Hanlon20-Nov-07 11:19 
QuestionAJAX Confirm Button Extender Pin
Sarfaraj Ahmed20-Nov-07 5:12
Sarfaraj Ahmed20-Nov-07 5:12 
AnswerRe: AJAX Confirm Button Extender Pin
M_Menon20-Nov-07 6:13
M_Menon20-Nov-07 6:13 
GeneralRe: AJAX Confirm Button Extender Pin
Sarfaraj Ahmed20-Nov-07 6:28
Sarfaraj Ahmed20-Nov-07 6:28 
AnswerRe: AJAX Confirm Button Extender Pin
SABhatti20-Nov-07 6:40
SABhatti20-Nov-07 6:40 
GeneralRe: AJAX Confirm Button Extender Pin
Sarfaraj Ahmed20-Nov-07 8:29
Sarfaraj Ahmed20-Nov-07 8:29 
AnswerRe: AJAX Confirm Button Extender Pin
SABhatti20-Nov-07 10:30
SABhatti20-Nov-07 10:30 
QuestionSettings is not a member of my Pin
JMUREKEZI20-Nov-07 4:58
JMUREKEZI20-Nov-07 4:58 
AnswerRe: Settings is not a member of my Pin
Not Active20-Nov-07 11:47
mentorNot Active20-Nov-07 11:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.