|
Rank: Advanced Member Groups: Member
Joined: 1/3/2008 Posts: 32
|
Can anyone give code for creating a treeview control inside in the slidemenu (like outlook inbox) dynamicall (in asp.net VB).
i am trying since long not getting result.
thanks
saji
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, An example is already available here: http://www.essentialobjects.com/Demo/Default.aspx?path=SlideMenuThe full source of the sample project is also on your local machine if you installed our controls. Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 1/3/2008 Posts: 32
|
i tried but not woking, posting below my code
please help me
.. reading data from database
SlideMenu1.Items.Clear()
For Each row In Ds.Tables("tblResult").Rows
Dim mItem As New EO.Web.MenuItem mItem.Text.Html = row.Item("menu_caption") & "" ' loading treeview in the below funciton Call LoadSubMenu(row.Item("menu_id") & "", mItem) SlideMenu1.Items.Add(mItem) Next
' Funciton to create and attach treeview
Private Sub LoadSubMenu(ByVal parentID As Integer, ByVal mItem As EO.Web.MenuItem)
Dim customItem As New EO.Web.CustomItem customItem.ID = "Custom_" & parentID
Dim tvObject As New EO.Web.TreeView tvObject.ID = "MyTv_" & parentID
For Each row In Ds.Tables("tblResult").Rows Dim tvNode As New EO.Web.TreeNode tvNode.Text = row.Item("menu_caption") & "" tvObject.Nodes.Add(tvNode) Next
' adding treeview to custom control customItem.Controls.Add(tvObject)
Dim sItem1 As New EO.Web.MenuItem sItem1.CustomItemID = customItem.ID
mItem.SubMenu.Items.Add(sItem1)
End Sub
saji
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Saji,
Can you explain specifically how it does not work? We know the sample works. And if your code does not work, you need to tell us exactly how it is not working. Did you get an error message? Or things do not show up at where they suppose to? Just telling us "it does not work" is like going to see your doctor and just telling him "I am sick". There is no way they are going to be able to do anything with you in that case. So we generally do not response such questions unless you provide specific details.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 1/3/2008 Posts: 32
|
Hi
Its not showing any error, its populating the Slidemenu properly, but when i click the slidemenu item, its not showing a treeview inside. and i am not getting any error while debugging also.
saji
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Please try with a static CustomItem first. Once you get CustomItem working, you can switch to dynamic CustomItem and then also put a Label or something else in your CustomItem, that way you will know whether it's CustomItem not created correctly or TreeView not populated correctly. Also try to create CustomItem in Page_Init instead of Page_Load or any other event handler. Dynamically created controls generally should be created at early stage of the page.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 1/3/2008 Posts: 32
|
Yes thanks for your support, finally it got worked
The problem is: customitem is not generating dynamically. so i created static custom item controls as many as required, then created treeview dynamically and assigned to the custom control object dynamically.
then added the custom control to the slidemenu.
is there any solution to create the custom controls dynamically??
the code i am posting below: some one can use
' dynamic custom item creation not working Dim tvObject As New EO.Web.TreeView tvObject.ID = "MyTv_" & parentID tvObject.TopGroup.Style.CssText = "background-image:url('00030417');background-repeat:repeat-y;border-bottom-color:#999999;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#999999;border-left-style:solid;border-left-width:1px;border-right-color:#999999;border-right-style:solid;border-right-width:1px;border-top-color:#999999;border-top-style:solid;border-top-width:1px;color:black;cursor:hand;font-family:Tahoma;font-size:11px;padding-bottom:2px;padding-left:2px;padding-right:2px;padding-top:2px;"
Dim rootNode As New EO.Web.TreeNode rootNode.Text = "Root"
Dim row As DataRow For Each row In Ds.Tables("tblResult").Rows Dim tvNode As New EO.Web.TreeNode tvNode.DisabledStyle.CssText = "background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;color:Gray;padding-bottom:1px;padding-left:1px;padding-right:1px;padding-top:1px;" tvNode.NormalStyle.CssText = "padding-right: 1px; padding-left: 1px; padding-bottom: 1px; color: black; border-top-style: none; padding-top: 1px; border-right-style: none; border-left-style: none; background-color: transparent; border-bottom-style: none" tvNode.SelectedStyle.CssText = "background-color:Silver;border-bottom-color:#999999;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#999999;border-left-style:solid;border-left-width:1px;border-right-color:#999999;border-right-style:solid;border-right-width:1px;border-top-color:#999999;border-top-style:solid;border-top-width:1px;color:white;padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px;"
tvNode.Text = row.Item("menu_caption") & "" tvNode.NavigateUrl = row.Item("menu_url") & "" tvNode.ToolTip = row.Item("tooltip") & "" tvNode.ImageUrl = row.Item("icon_url") & "" If row.Item("target") & "" <> "" Then tvNode.TargetWindow = row.Item("target") & ""
RootNode.ChildNodes.Add(tvNode) Next tvObject.Nodes.Add(RootNode)
Ds.Clear() Ds = Nothing
' Five custom items created statically ' CustomerItem1, CustomerItem2 ....CustomerItem5 ' Parent Id starts with 100,200 ... 500
' find the statically created control Dim customItem As EO.Web.CustomItem customItem = CType(Me.FindControl("CustomItem" & Left(parentID.ToString, 1)), EO.Web.CustomItem) customItem.Controls.Add(tvObject)
' add the tree menu to SubItem Dim sItem1 As New EO.Web.MenuItem sItem1.CustomItemID = customItem.ID
' Add the subitem to the main menu item mItem.SubMenu.Items.Add(sItem1)
|
|