Click here to Skip to main content
16,014,748 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionIs the Unload event fired when Page Caching is enabled? Pin
jrhea25-Aug-08 13:08
jrhea25-Aug-08 13:08 
AnswerRe: Is the Unload event fired when Page Caching is enabled? Pin
AlexeiXX325-Aug-08 16:22
AlexeiXX325-Aug-08 16:22 
GeneralRe: Is the Unload event fired when Page Caching is enabled? Pin
jrhea25-Aug-08 17:46
jrhea25-Aug-08 17:46 
GeneralRe: Is the Unload event fired when Page Caching is enabled? Pin
AlexeiXX325-Aug-08 17:59
AlexeiXX325-Aug-08 17:59 
GeneralRe: Is the Unload event fired when Page Caching is enabled? Pin
jrhea25-Aug-08 18:13
jrhea25-Aug-08 18:13 
QuestionTreeview Pin
Steve R Adams25-Aug-08 10:48
Steve R Adams25-Aug-08 10:48 
AnswerRe: Treeview Pin
AlexeiXX325-Aug-08 16:18
AlexeiXX325-Aug-08 16:18 
GeneralRe: Treeview Pin
Steve R Adams28-Aug-08 10:24
Steve R Adams28-Aug-08 10:24 
Thanks Alexei

Can I ask you a favor. I am anyway going to post this message in another forum but maybe you can have a look and see if you see something wrong with it.

Thanks
Steve

Imports System.Data
Imports System.Web.UI.WebControls
Partial Class members_organization_mysampletreeview
Inherits System.Web.UI.Page
Dim memberid As Long
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

' THIS IS THE ID OF THE LOGGED IN USER WHICH IS BASICALLY THE ROOT NODE OF THE TREE
memberid = 3

If IsPostBack = False Then
populaterootlevel()
End If

End Sub

Public Sub populaterootlevel()
Dim mycon As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("trafficbobbyconstringaccess").ToString())
Dim mycmd As New OleDb.OleDbCommand
Dim strsql As String
Dim dr As OleDb.OleDbDataReader
Dim NoOfDownline As Integer

'Find out how many child nodes this parent is supposed to have
strsql = "SELECT members.RisingEagleSponsor AS ID, Count(members.RisingEagleID) AS Parent"
strsql = strsql & " FROM(members)"
strsql = strsql & " GROUP BY members.RisingEagleSponsor"
strsql = strsql & " HAVING (((members.RisingEagleSponsor)=" & memberid & " ));"

mycmd.Connection = mycon
mycmd.CommandText = strsql
If mycon.State <> ConnectionState.Open Then
mycon.Open()
End If
dr = mycmd.ExecuteReader
dr.Read()
If dr.HasRows = True Then
NoOfDownline = dr.Item("Parent")
End If
dr.Close()

strsql = "SELECT members.RisingEagleID AS ID, 0 AS Parent, members.MemberName AS Title, " & NoOfDownline & " as childnodecount"
strsql = strsql & " FROM(members)"
strsql = strsql & " WHERE (((members.RisingEagleID)=" & memberid & "));"

mycmd.Connection = mycon
mycmd.CommandText = strsql
If mycon.State <> ConnectionState.Open Then
mycon.Open()
End If
Dim da As New OleDb.OleDbDataAdapter(mycmd)
Dim dt As New DataTable
da.Fill(dt)
mycon.Close()
PopulateNodes(dt, Me.TreeView1.Nodes)


End Sub

Public Sub populatesublevel(ByVal parentid As Integer, ByVal parentnode As TreeNode)
Dim mycon As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("trafficbobbyconstringaccess").ToString())
Dim mycmd As New OleDb.OleDbCommand
Dim strsql As String

'Get the final list of all the downline for this member
strsql = "SELECT members.RisingEagleID AS ID, members.RisingEagleSponsor AS Parent, members.MemberName AS Title, AllParents.childnodecount"
strsql = strsql & " FROM members"
strsql = strsql & " INNER JOIN AllParents ON members.RisingEagleSponsor = AllParents.Parent"
strsql = strsql & " WHERE members.RisingEagleSponsor = " & parentid
strsql = strsql & " ORDER BY members.RisingEagleSponsor"

mycmd.Connection = mycon
If mycon.State <> ConnectionState.Open Then
mycon.Open()
End If
mycmd.CommandText = strsql


Dim da As New OleDb.OleDbDataAdapter(mycmd)
Dim dt As New DataTable
da.Fill(dt)
mycon.Close()
PopulateNodes(dt, Me.TreeView1.Nodes)
End Sub

Public Sub TreeView1_TreeNodePopulate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.TreeNodeEventArgs) Handles TreeView1.TreeNodePopulate
On Error GoTo errhandler

populatesublevel(Int32.Parse(e.Node.Value), e.Node)

Errhandler:
Select Case Err.Number
Case 0
Exit Sub
Case Else
Dim mymsg As String
mymsg = Err.Number & " " & Err.Description
End Select
End Sub

Public Sub PopulateNodes(ByVal dt As DataTable, ByVal nodes As TreeNodeCollection)
On Error GoTo errhandler
Dim mymsg As String
For Each dr As DataRow In dt.Rows
mymsg = dt.Rows.Count
Dim tn As TreeNode = New TreeNode()
tn.Text = dr("Title").ToString()
tn.Value = dr("ID").ToString
nodes.Add(tn)

'If node has child nodes then enable on-demand populating
tn.PopulateOnDemand = CType(dr.Item("childnodecount"), Long) > 0
Next


mymsg = "123"
Errhandler:
Select Case Err.Number
Case 0
Exit Sub
Case Else

mymsg = Err.Number & " " & Err.Description
End Select
End Sub
End Class
GeneralRe: Treeview Pin
AlexeiXX328-Aug-08 10:40
AlexeiXX328-Aug-08 10:40 
GeneralRe: Treeview Pin
Steve R Adams28-Aug-08 11:47
Steve R Adams28-Aug-08 11:47 
GeneralRe: Treeview Pin
Steve R Adams2-Sep-08 11:57
Steve R Adams2-Sep-08 11:57 
GeneralRe: Treeview Pin
AlexeiXX33-Sep-08 6:41
AlexeiXX33-Sep-08 6:41 
Questiongmail "more actions" menu? Pin
Todd Smith25-Aug-08 9:22
Todd Smith25-Aug-08 9:22 
AnswerRe: gmail "more actions" menu? Pin
Colin Angus Mackay25-Aug-08 10:51
Colin Angus Mackay25-Aug-08 10:51 
QuestionFileUpload and the content type Pin
Fernando A. Gomez F.25-Aug-08 9:07
Fernando A. Gomez F.25-Aug-08 9:07 
AnswerRe: FileUpload and the content type Pin
Christian Graus25-Aug-08 9:44
protectorChristian Graus25-Aug-08 9:44 
GeneralRe: FileUpload and the content type Pin
Fernando A. Gomez F.25-Aug-08 12:15
Fernando A. Gomez F.25-Aug-08 12:15 
AnswerRe: FileUpload and the content type Pin
Todd Smith25-Aug-08 9:51
Todd Smith25-Aug-08 9:51 
GeneralRe: FileUpload and the content type Pin
Fernando A. Gomez F.25-Aug-08 12:24
Fernando A. Gomez F.25-Aug-08 12:24 
QuestionFree mail client Pin
Md Nazmoon Noor25-Aug-08 7:31
Md Nazmoon Noor25-Aug-08 7:31 
QuestionHow to maintain Seesion in windows application Pin
Rickey_Me25-Aug-08 6:42
Rickey_Me25-Aug-08 6:42 
AnswerRe: How to maintain Seesion in windows application Pin
Colin Angus Mackay25-Aug-08 7:09
Colin Angus Mackay25-Aug-08 7:09 
GeneralRe: How to maintain Seesion in windows application Pin
Rickey_Me25-Aug-08 7:59
Rickey_Me25-Aug-08 7:59 
GeneralRe: How to maintain Seesion in windows application Pin
Manas Bhardwaj25-Aug-08 8:16
professionalManas Bhardwaj25-Aug-08 8:16 
GeneralRe: How to maintain Seesion in windows application Pin
Colin Angus Mackay25-Aug-08 9:16
Colin Angus Mackay25-Aug-08 9:16 

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.