I'm trying to use a Treeview control in a Razor Host script within DNN 6.2. I'm not sure what the basics are in that regard. Here is what I have so far. Am I even close? Are there existing Razor examples I could look at? Thanks for any help you can provide.
@using DotNetNuke.Entities.Tabs
@using DotNetNuke.Web.UI.WebControls
@{
var tabs = TabController.GetTabsByParent(2938, Dnn.Portal.PortalId);
var tree = new DnnTreeView();
tree.DataSource = tabs;
tree.DataTextField = "TabName";
tree.DataValueField = "TabId";
tree.DataFieldParentID = "ParentId";
tree.DataBind();
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
}
@{
tree.RenderControl(hw);
}
@using DotNetNuke.Entities.Tabs
@using DotNetNuke.Web.UI.WebControls
@{
var tabs = TabController.GetTabsByParent(2938, Dnn.Portal.PortalId);
var tree = new DnnTreeView();
tree.DataSource = tabs;
tree.DataTextField = "TabName";
tree.DataValueField = "TabId";
tree.DataFieldParentID = "ParentId";
tree.DataBind();
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
}
@{
tree.RenderControl(hw);
}