Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, one day and no comment :), I got it done using RadTreeView, the RadTreeNode supports custom attributes, I added a custom attribute to distinguish between a category and an item, and in the NodeTemplate I used MultiView control which chooses the View to display by checking the node custom attribute. </p> <p>Here is some parts of the code,</p> <pre><code>&lt;telerik:RadTreeView ID="rtvQueries" runat="server" OnNodeExpand="rtvQueries_NodeExpand" Skin="Black" OnClientNodeClicking="CheckNodeType" OnNodeClick="rtvQueries_NodeClick"&gt; &lt;NodeTemplate&gt; &lt;asp:HiddenField ID="hfId" runat="server" Value='&lt;%# Container.Value %&gt;' /&gt; &lt;asp:MultiView ID="mvAll" runat="server" ActiveViewIndex='&lt;%# Container.Attributes["ItemType"] == "C"? 0 : 1 %&gt;'&gt; &lt;asp:View ID="vwCategory" runat="server"&gt; &lt;asp:Label ID="lblCategory" runat="server" Text='&lt;%# Container.Text %&gt;' /&gt; &lt;/asp:View&gt; &lt;asp:View ID="vwQuery" runat="server"&gt; &lt;div style="float: left"&gt; &lt;asp:Label ID="lblQuery" runat="server" Text='&lt;%# Container.Text %&gt;' /&gt; &lt;/div&gt; &lt;div style="float: left; margin-left: 20px; overflow: hidden; width: 200px;"&gt; &lt;asp:Label ID="lblCommandText" runat="server" Text='&lt;%# Container.Attributes["CommandText"] %&gt;' /&gt; &lt;/div&gt; &lt;/asp:View&gt; &lt;/asp:MultiView&gt; &lt;/NodeTemplate&gt; &lt;/telerik:RadTreeView&gt; </code></pre> <p>The code-behind for NodeExpand,</p> <pre><code>protected void rtvQueries_NodeExpand(object sender, RadTreeNodeEventArgs e) { Guid categoryId = new Guid(e.Node.Value); List&lt;Category&gt; cats = DBHelper.GetQueryCategories(categoryId); cats.ForEach(c =&gt; { RadTreeNode n = new RadTreeNode(c.Name, c.Id.ToString()); n.ExpandMode = TreeNodeExpandMode.ServerSideCallBack; n.Attributes["ItemType"] = "C"; e.Node.Nodes.Add(n); n.DataBind(); }); List&lt;RightBI.Query&gt; queries = DBHelper.GetQueriesByCategoryId(categoryId); queries.ForEach(q =&gt; { RadTreeNode n = new RadTreeNode(q.Name, q.Id.ToString()); n.Attributes["ItemType"] = "Q"; n.Attributes["CommandText"] = q.CommandText; e.Node.Nodes.Add(n); n.DataBind(); }); } </code></pre> <p>The only problem in this solution is I have to call DataBind on each node after adding it to the TreeView so the binding expressions evaluated.</p> <p>I still would like to see other solutions and comments on this solution or better ideas.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload