Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to maintain the tree view user interactions through post back?
    primarykey
    data
    text
    <p>I use <code>RadTreeView</code> in my master page :</p> <p>but i face the following problem :</p> <p>I lose my selections when i click on the nodes of the tree view .and every time i click on the node it makes <code>(Response.Redirect("..."))</code> which make the master entering the <code>(!Page.IsPostback)</code> every time and bind the tree view again so i lose my selections .</p> <p>How to fix this problem .</p> <p><strong>My .aspx :</strong></p> <pre><code> &lt;telerik:RadTreeView ID="rtv_cm" runat="server" OnNodeExpand="rtv_cm_NodeExpand" OnNodeClick="rtv_cm_NodeClick" Skin="WebBlue"&gt; &lt;/telerik:RadTreeView&gt; </code></pre> <hr> <p><strong>My .cs :</strong></p> <pre><code> protected void Page_Load(object sender, EventArgs e) { if (Session["emp_num"] != null &amp;&amp; !string.IsNullOrEmpty(Session["emp_num"].ToString())) { if (!Page.IsPostBack) { LoadRootNodes(rtv_cm, TreeNodeExpandMode.ServerSide); } } else { Response.Redirect("Frm_login.aspx"); } } </code></pre> <hr> <pre><code>protected void rtv_cm_NodeClick(object sender, RadTreeNodeEventArgs e) { dt_childs = (DataTable)Session["dt_childs"]; IEnumerable&lt;DataRow&gt; result = from myRow in dt_childs.AsEnumerable() where myRow.Field&lt;string&gt;("task_id").TrimEnd() == e.Node.Value.TrimEnd() select myRow; if (result != null) { if (!string.IsNullOrEmpty(result.ElementAtOrDefault(0).Field&lt;string&gt;("page_name"))) { Response.Redirect(result.ElementAtOrDefault(0).Field&lt;string&gt;("page_name").TrimEnd(), false); } } } </code></pre> <hr> <p><strong>How I get The menu :</strong></p> <pre><code> private void LoadRootNodes(RadTreeView treeView, TreeNodeExpandMode expandMode) { dt = Menu_db.GetMenu(Session["emp_num"].ToString(), CMSession.Current.db_code); IEnumerable&lt;DataRow&gt; result = from myRow in dt.AsEnumerable() where myRow.Field&lt;string&gt;("task_id").TrimEnd() == "0" select myRow; if (result != null &amp;&amp; result.Count()&gt;0) { DataTable dt_roots = result.CopyToDataTable&lt;DataRow&gt;(); Session["dt"] = dt; Session["dt_roots"] = dt_roots; foreach (DataRow row in dt_roots.Rows) { RadTreeNode node = new RadTreeNode(); node.Text = row["task_name"].ToString().TrimEnd(); node.Value = row["task_id"].ToString().TrimEnd(); if (Convert.ToInt32(row["count"]) &gt; 0) { node.ExpandMode = expandMode; } treeView.Nodes.Add(node); } } } </code></pre>
    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. 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