Basic Razor Question

2 posts, 0 answers
  1. David
    David avatar
    1 posts
    Member since:
    Jun 2012

    Posted 20 Jun 2012 Link to this post

    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";
        System.IO.StringWriter tw = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
  2. Daniel
    Daniel avatar
    2231 posts

    Posted 25 Jun 2012 Link to this post

    Hello David,

    The TreeView is a Web Forms control and so it can be used only in a Web Forms View(ASPX). In order to create it in a View that uses the Razor view engine, you could try to render it in a partial ASPX View. 

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top