Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
am binding tree view from database ,and i have a button add node in my page

when i select a node in tree view then i click add node button am showing a popup with name text box.when i click add button i want to add child node for selected node in tree view

i want to insert selected node id as parent and name

What I have tried:

HTML
@helper GetTreeView(List<AccountsPageLayout.MasterNode> siteMenu, int parentID)
{
    foreach (var i in siteMenu.Where(a => a.ReportsTo.Equals(parentID)))
    {
        <li>
            @{var submenu = siteMenu.Where(a => a.ReportsTo.Equals(i.EmpID)).Count();}
            @if (submenu > 0)
            {
                <span class="collapse collapsible"> </span>
            }
            else
            {
                <span style="width:15px; display:inline-block"> </span>
            }
            <span id="category">
                <a href="#@i.EmpID" >@i.Name</a>

                @*<a href="@i.EmpID">@i.Name</a>*@
            </span>
            @if (submenu > 0)
            {
                <ul>
                    @Treeview.GetTreeView(siteMenu, i.EmpID)
                    @* Recursive  Call for Populate Sub items here*@
                </ul>
            }
        </li>
    }
}



adding node
HTML
<input type="text" name="MasterName">
               @Html.ActionLink("Add", "addMaster", "Treeview")


controller
public ActionResult addMaster(string ID)
{
return View();
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900