Mennan Mennan - 5 months ago 44
ASP.NET (C#) Question

How to set treeview's childnode postback false on ASP.NET?

I have a treeview and i want no postback on click any childnodes.And i will get selected childnode value.
I found a solution , when i set "node_.SelectAction = TreeNodeSelectAction.None;" i cant select any childnodes and no highlight on it.

Waiting your helps.Sorry about my en.


<asp:TreeView ID="TreeView1" runat="server"></asp:TreeView>


TreeView1.TreeNodeExpanded += new TreeNodeEventHandler(TreeView1_TreeNodeExpanded);

DataTable dt = ImzaDll.Imza.KategorileriGetir(true);

foreach (DataRow row in dt.Rows)
TreeNode node_ = new TreeNode();
node_.Text = row["ACIKLAMA"].ToString();
node_.Value = row["KATEGORI"].ToString();

void TreeView1_TreeNodeExpanded(object sender, TreeNodeEventArgs e)

private void addChildNodes(TreeNode node)
DataTable dt = ImzaDll.Imza.KutuphaneBasliklariGetir(true, node.Value.ToString());

foreach (DataRow row in dt.Rows)
TreeNode childNode = new TreeNode();
childNode.Text = row["BASLIK"].ToString();
childNode.Value = row["KUTUPHANE_ID"].ToString();
childNode.ToolTip = row["BASLIK"].ToString() + " kütüphanesini ekle";
childNode.Target = "_new";



You can set CSSClass of treeview child nodes like

      <asp:TreeView LeafNodeStyle-CssClass="childnode" runat="server">....</asp:TreeView>

then using jquery you get get class and set return false like follow.

                 return false;

...same way you can set RootNodeStyle-CssClass, ParentNodeStyle-CssClass class and use jquery to set them...