generate html/asp dynamically

munzevi

New Member
I have a treeview type structure of folders/links that's populated from a table. What I was attempting to do was procedural loop through my recordset and generate my html in page_init and then try and bind the controls. When I try to add the link buttons to the placeholders in html, it can never seem to find them.I might be missing something fundamental here, all the examples i've seen bind a control thats already on the page, am I unable to generate the html myself in page_init?example\[code\]Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init content_div.Innerhtml = "<asp:PlaceHolder id=""test"" runat=""server"" ></asp:PlaceHolder>End SubProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Dim _linkb As New LinkButton _linkb.ID = "lb_cat_" & cat.uID _linkb.Attributes.Add("href", "javascript: sltoggle('cat_" & cat.uID & "');") _linkb.Attributes.Add("Text", "Expand/Close") _linkb.Attributes.Add("runat", "server") Dim ph As PlaceHolder = DirectCast(TRIEDEVERYTHINGUNDERTHESUN.FindControl("test"), PlaceHolder) ph.Controls.Add(_linkb)End Sub\[/code\]If someone could point me in the right direction it'd be much appreciatedRegards,Pete
 
Back
Top