I feel I'm pretty close to getting this right but my drop down list wont display the child nodes of a specified node, it wont even display the "Please Select" items before the for next...anyone any ideas where i'm going wrong?
Protected Sub Page_Load(sender As Object, e As EventArgs) If Not IsPostBack Then cboService.Items.Add(New ListItem("--- Please Select ---", "")) cboService.Items.Add(New ListItem("Other (Please detail in aditional info)", "Other")) Dim specificNode = New Node(1768) 'Get the children as a Nodes collection Dim childNodes = specificNode.Children For Each childNode As Node In childNodes cboService.Items.Add(New ListItem(childNode.Name, childNode.Id)) Next End If End Sub
I have a post build script that copies the bin file and ascx file accross upon a successfull build, i've doubled checked this is happening, which it is.
Its strange that its not even adding the "Please Select" item....just getting an empty drop down list.
'after creating the document, prepare it for publishing
doc.Save()
'doc.Publish(author)
'Tell umbraco to publish the document
'umbraco.library.UpdateDocumentCache(doc.Id)
Catch ex As Exception
panFeedbackSucess.Visible = False
panFeedback.Visible = False
litInfoErrorMessage.Text = "<p>Sorry there was an error we did not manage to capture your details to the database but they may have been sent by email.</p>"
End Try
'Now go do the emails..
Try
Dim MyMailer As New MailMessage
Dim MySmtpClient As New SmtpClient()
MyMailer = New MailMessage
MyMailer.From = New MailAddress("www.glasgowplastering.co.uk", "[email protected]")
That actually looks fine to me. Try a rebuild instead of a build... triple check the DLL is being updated. Make sure you are referencing the right usercontrol in umbraco. Create a new macro in umbraco and see if that helps.
it gets stranger...i managed to get the control working using the sample from umbraco but its in C#, so i converted the code to VB to let me do my other stuff and it no longer works....wtf am I doing wrong?
User control with drop list of Childnodes
I feel I'm pretty close to getting this right but my drop down list wont display the child nodes of a specified node, it wont even display the "Please Select" items before the for next...anyone any ideas where i'm going wrong?
Updated your DLL?
I have a post build script that copies the bin file and ascx file accross upon a successfull build, i've doubled checked this is happening, which it is.
Its strange that its not even adding the "Please Select" item....just getting an empty drop down list.
S
Everything ALWAYS has a reason so I doubt its "strange" :) Can you post the full code behind and ascx page?
That actually looks fine to me. Try a rebuild instead of a build... triple check the DLL is being updated. Make sure you are referencing the right usercontrol in umbraco. Create a new macro in umbraco and see if that helps.
thanks Skiltz, appreciate your input, I'll go try what you suggested and report back,
S
Ok checked everything and still the same result. I'm now going to try and use one of the examples from umrbaco TV to see if that works....
S
it gets stranger...i managed to get the control working using the sample from umbraco but its in C#, so i converted the code to VB to let me do my other stuff and it no longer works....wtf am I doing wrong?
S
Jez...i got it at last...all to do with the page load...
i had
and it should be
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dont know how the feck i missed it but at least i've confirmed that I'm not officially mental!
Thanks again..
S
Hello,
Nice to see it's fixed. If you want to databind children here might be some useful examples: http://our.umbraco.org/wiki/reference/code-snippets/databind-node-children.
Jeroen
is working on a reply...