Actually fixed that, but now I am getting real close ;o)
On the line:
For Each currentRow In dt.Rows <-----ERRORING ON THIS LINE (*Cast from type
'DataRow' to type 'Integer' is not valid.*)
Return dt.Rows(currentRow).Item(3)
GetChildNodes(NodeID)
Next
Any ideas?
Also, right now it is returning the info on the page as:
Level 1, Level 2
And ideally at the end I want it to show as:
Level 1
Sub Level 1
Sub Sub Level 1
My question is, how will the code know if its at a point where it should
indent?
On 10/3/05, Dean Fiala <[EMAIL PROTECTED]> wrote:
>
> The only thing I can find with this is that there is an error in the SQL
> connection string.
>
> On 10/3/05, Mike Appenzellar <[EMAIL PROTECTED]> wrote:
> >
> > Now I get "*Format of the initialization string does not conform to
> > specification starting at index 0.* " any ideas?
> >
> > On 9/30/05, Dean Fiala <[EMAIL PROTECTED]> wrote:
> >
> > > Never been a fan of the scripting syntax...
> > >
> > > <%# GetChildNodes(Container.DataItem) %>
> > >
> > > But it looks like you are passing a DataItem, when your function calls
> > > for an Integer.
> > >
> > > Perhaps you mean
> > > <%# GetChildNodes(Container.DataItem("id")) %>
> > >
> > > Of course, the way you have it set up means that your entire heirarchy
> > > is going to be in the first item.
> > >
> > > Are you trying to build an infinitely nested repeater?
> > >
> > > On 9/30/05, Mike Appenzellar <[EMAIL PROTECTED] > wrote:
> > > > I am REALLY hoping you can help me out more with this (still very
> much
> > > a
> > > > beginner in this whole .net world)....this is what I have but
> > > something is
> > > > for sure wrong!:
> > > >
> > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > System.EventArgs) Handles MyBase.Load
> > > > Dim Conn As SqlConnection
> > > > Dim Rdr As SqlDataAdapter
> > > > Dim RdrSet As DataSet
> > > > Conn = New SqlConnection(AppSettings("embassyConnect"))
> > > > Rdr = New SqlDataAdapter("SELECT id, pid, navTitle, pageTitle FROM
> > > > NAVIGATION WHERE pid = 0 ORDER BY sortOrder ASC", Conn)
> > > > RdrSet = New DataSet
> > > > Rdr.Fill(RdrSet, "Navigation1")
> > > > nav1.DataSource = RdrSet
> > > > nav1.DataBind()
> > > > End Sub
> > > >
> > > > Public Function GetChildNodes(ByVal NodeID) As String
> > > > Dim dt As New DataTable
> > > > Dim myConnection As New SqlConnection("embassyConnect")
> > > > Dim currentRow As Integer
> > > > Dim sql As String = "Select * from NAVIGATION where parentID = " &
> > > NodeID
> > > > Dim myCommand As New SqlCommand(sql, myConnection)
> > > > Dim myAdapter As New SqlDataAdapter(myCommand)
> > > > myAdapter.Fill(dt)
> > > >
> > > > For Each currentRow In dt.Rows
> > > > Print(dt.Rows(currentRow).Item(3))
> > > > GetChildNodes(NodeID)
> > > > Next
> > > >
> > > > End Function
> > > > Then on the public side:
> > > > <asp:Repeater id="nav1" runat="server">
> > > > <ItemTemplate>
> > > > <%# GetChildNodes(Container.DataItem) %>
> > > > </ItemTemplate>
> > > > </asp:Repeater><%# GetChildNodes( Container.DataItem) %>
> > > >
> > > > On 9/30/05, Matías Niño ListMail <[EMAIL PROTECTED] > wrote:
> > > > >
> > > > > It's actually pretty simple, and you don't even need that many
> > > columns.
> > > > >
> > > > > All you need in your table is:
> > > > >
> > > > > NodeID (the identifier for the node)
> > > > > NodeParentID (that node's parent, if the node is a root node, just
> > > leave
> > > > > it null or designate a special value)
> > > > >
> > > > > To dig up and print all sub-levels for any given node, just run
> the
> > > > > following recursive function as such:
> > > > >
> > > > > <pseudocode>
> > > > > Function GetChildNodes(NodeID)
> > > > > sql = Select * from table where parentID = " & NodeID
> > > > > execute sql into new datatable
> > > > > for each currentrow in datatable
> > > > > print node info
> > > > > GetChildNodes(currentrow("NodeID"))
> > > > > loop
> > > > > End Function
> > > > > </pseudocode>
> > > > >
> > > > > Remember that if you have a ton of nodes with many levels and
> > > subnodes,
> > > > > performance takes a big hit. If you want to limit the levels, you
> > > can add a
> > > > > counter integer paramenter into the function and pass the
> increment
> > > to only
> > > > > dig as many levels as the counter limit.
> > > > >
> > > > > Good luck!
> > > > >
> > > > > -Matias
> > > > > Manassas, VA
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > >
> > > > > From: [email protected] [mailto:
> > > > > [EMAIL PROTECTED] On Behalf Of Mike
> Appenzellar
> > > > > Sent: Thursday, September 29, 2005 5:58 PM
> > > > > To: [email protected]
> > > > > Subject: Re: [AspNetAnyQuestionIsOk] unlimited nesting
> > > > >
> > > > >
> > > > > That is exactly how my table is setup, but I dont' really see how
> to
> > > > > implement it with the loops, etc. The link you sent unforuntately
> > > doens't
> > > > > tell me much.
> > > > >
> > > > > On 9/29/05, Dean Fiala <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > Simple form, infinite levels. All you need are three columns
> > > > > >
> > > > > > ID
> > > > > > Parent ID
> > > > > > Desc
> > > > > >
> > > > > > ID Parent ID Desc
> > > > > > -----------------------------------
> > > > > > 1 -1 Root
> > > > > > 2 1 First Child
> > > > > > 3 1 Second Child
> > > > > > 4 3 Grandchild A
> > > > > > 5 3 Grandchild B
> > > > > > etc...
> > > > > >
> > > > > > You can walk the hierarchy in either direction.
> > > > > >
> > > > > > Check out tree walking, recursive trees, etc. For example,
> > > > > >
> > > > > >
> > > > >
> > >
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvbadev/html/traversingtreewalkingcode.asp
> > > > > >
> > > > > >
> > > > > > On 9/29/05, Charles Carroll < [EMAIL PROTECTED]> wrote:
> > > > > > > Recursion. Research it.
> > > > > > >
> > > > > > > On 9/29/05, Mike Appenzellar < [EMAIL PROTECTED]> wrote:
> > > > > > > >
> > > > > > > > I have a database structure setup as follows:
> > > > > > > > ID NAME PID
> > > > > > > > 1 Level1 0
> > > > > > > > 2 Level2 0
> > > > > > > > 3 Level3 0
> > > > > > > > 4 SubLevel1 1
> > > > > > > > 5 SubLevel2 2
> > > > > > > > 6. SubSub1 4
> > > > > > > > and so on...
> > > > > > > > Right now I have nested loops that take care of this BUT the
> > > problem
> > > > > > is
> > > > > > > > that I have to pre-plan on how many potential levels there
> > > might be.
> > > > > I
> > > > > > > > would
> > > > > > > > like to somehow right my queries or loops to plan for an
> > > unlimitied
> > > > > > amount
> > > > > > > > of levels.....any ideas?
> > > > > > >
> > > > > > >
> > > > > > > [Non-text portions of this message have been removed]
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Yahoo! Groups Links
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Dean Fiala
> > > > > > Very Practical Software, Inc
> > > > > > http://www.vpsw.com
> > > > > >
> > > > > > ------------------------------
> > > > > > YAHOO! GROUPS LINKS
> > > > > >
> > > > > >
> > > > > > - Visit your group "AspNetAnyQuestionIsOk<
> > > > > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk>"
> > > > > > on the web.
> > > > > > - To unsubscribe from this group, send an email to:
> > > > > > [EMAIL PROTECTED]<
> > > > > [EMAIL PROTECTED]
> > > ?subject=Unsubscribe>
> > > > > > - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > > > > > Service <http://docs.yahoo.com/info/terms/>.
> > > > > >
> > > > > >
> > > > > > ------------------------------
> > > > > >
> > > > >
> > > > >
> > > > > [Non-text portions of this message have been removed]
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > >
> > > > > YAHOO! GROUPS LINKS
> > > > >
> > > > >
> > > > >
> > > > > * Visit your group "AspNetAnyQuestionIsOk <
> > > > > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk> " on the web.
> > > > >
> > > > > * To unsubscribe from this group, send an email to:
> > > > > [EMAIL PROTECTED] <mailto:
> > > > > [EMAIL PROTECTED]
> > > ?subject=Unsubscribe>
> > > > >
> > > > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > > Service <
> > > > > http://docs.yahoo.com/info/terms/> .
> > > > >
> > > > >
> > > > > ________________________________
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > [Non-text portions of this message have been removed]
> > > > >
> > > > >
> > > > >
> > > > > SPONSORED LINKS
> > > > > Basic programming language<
> http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=clJRDppRYABhs6xUhzokKw
> > > > Computer
> > > > > programming languages<
> http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=RiWZhYTiihJ1rWfeFgB2sg
> > > > Programming
> > > > > languages<
> http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=2BgLsjKfGvxPndstKBMU9g
> > > > Java
> > > > > programming language<
> http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=4wWSX5WKx7BCK9SrMVdrxQ
> > > > The
> > > > > history of computer programming language<
> http://groups.yahoo.com/gads?t=ms&k=The+history+of+computer+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=iNvYp6cfd9HwtDhK1iV-rg
> > > >
> > > > > ------------------------------
> > > > > YAHOO! GROUPS LINKS
> > > > >
> > > > >
> > > > > - Visit your group "AspNetAnyQuestionIsOk<
> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk
> > > >"
> > > > > on the web.
> > > > > - To unsubscribe from this group, send an email to:
> > > > > [EMAIL PROTECTED]<
> > > [EMAIL PROTECTED]>
> > > > > - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > > > > Service < http://docs.yahoo.com/info/terms/>.
> > > > >
> > > > >
> > > > > ------------------------------
> > > > >
> > > >
> > > >
> > > > [Non-text portions of this message have been removed]
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Dean Fiala
> > > Very Practical Software, Inc
> > > http://www.vpsw.com
> > >
> > >
> > > SPONSORED LINKS
> > > Basic programming language<
> http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=clJRDppRYABhs6xUhzokKw>
> Computer programming languages<
> http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=RiWZhYTiihJ1rWfeFgB2sg>
> Programming languages<
> http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=2BgLsjKfGvxPndstKBMU9g>
> Java
> > > programming language<
> http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=4wWSX5WKx7BCK9SrMVdrxQ>
> The
> > > history of computer programming language<
> http://groups.yahoo.com/gads?t=ms&k=The+history+of+computer+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=iNvYp6cfd9HwtDhK1iV-rg
> >
> > > ------------------------------
> > > YAHOO! GROUPS LINKS
> > >
> > >
> > > - Visit your group "AspNetAnyQuestionIsOk<
> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk>"
> > > on the web.
> > > - To unsubscribe from this group, send an email to:
> > > [EMAIL PROTECTED]<
> [EMAIL PROTECTED]>
> > > - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > > Service <http://docs.yahoo.com/info/terms/>.
> > >
> > >
> > > ------------------------------
> > >
> >
> >
>
>
> --
> Dean Fiala
> Very Practical Software, Inc
> http://www.vpsw.com
>
>
> [Non-text portions of this message have been removed]
>
>
>
> SPONSORED LINKS
> Basic programming
> language<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=clJRDppRYABhs6xUhzokKw>
> Computer
> programming
> languages<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=RiWZhYTiihJ1rWfeFgB2sg>
> Programming
> languages<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=2BgLsjKfGvxPndstKBMU9g>
> Java
> programming
> language<http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=4wWSX5WKx7BCK9SrMVdrxQ>
> The
> history of computer programming
> language<http://groups.yahoo.com/gads?t=ms&k=The+history+of+computer+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=iNvYp6cfd9HwtDhK1iV-rg>
> ------------------------------
> YAHOO! GROUPS LINKS
>
>
> - Visit your group
> "AspNetAnyQuestionIsOk<http://groups.yahoo.com/group/AspNetAnyQuestionIsOk>"
> on the web.
> - To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]<[EMAIL PROTECTED]>
> - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------
>
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/