Search code examples
c#asp.nettreeviewradiobuttonlist

treeview with radiobuttonlist


I am developing a website. I need to show a RadioButtonList in a TreeView, but I can't find any solutions showing me how to implement it.


Solution

  • If you want to add a RadioButton before the treenode instead of the checkbox:

    protected void TreeView1_TreeNodeDataBound(object sender, TreeNodeEventArgs e)
    {
      e.Node.Text = "<input type='radio' />" + e.Node.Text;
    }
    
    protected override void Render(HtmlTextWriter writer)
    {
        base.Render(writer);
        TreeView1.RenderControl(writer);
    }

    Hope it helps