This question is locked. New answers and comments are not allowed.
The issue i am having is that i have a MVC treeview control on an ASPX page with ShowCheckBox set to true. I check off a couple of the check boxes and post the form to my controller action, the parameter of the list of TreeViewItems that is supposed to be populated with the TreeViewItems that had their checkboxes checked off is always null, please HELP!!!!
Index.aspx
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %><asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Home Page</asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2><%: ViewData["Message"] %></h2> <p> To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc<;/a>. </p> <% using (Html.BeginForm("Test", "Home", FormMethod.Post)) %> <% { %> <%= Html.Telerik().TreeView() .Name("TestTree") .ShowCheckBox(true) .Items(item => { item.Add() .Text("Mail") .Items(subItem => { subItem.Add() .Text("Personal Folders"); }); }) %> <input type="submit" value="submit" /> <% } %></asp:Content>Site.Master
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title> <link href="../../Content/Site.css" rel="stylesheet" type="text/css" /> <%= Html.Telerik().StyleSheetRegistrar() .DefaultGroup(group => group .Add("telerik.common.css") .Add("telerik.vista.css")) %> <script type="text/javascript" src="<%= Url.Content("~/Scripts/jquery-1.5.1.min.js")%>"></script></head><body> <div class="page"> <div id="header"> <div id="title"> <h1>My MVC Application</h1> </div> <div id="logindisplay"> <% Html.RenderPartial("LogOnUserControl"); %> </div> <div id="menucontainer"> <ul id="menu"> <li><%: Html.ActionLink("Home", "Index", "Home")%></li> <li><%: Html.ActionLink("About", "About", "Home")%></li> </ul> </div> </div> <div id="main"> <asp:ContentPlaceHolder ID="MainContent" runat="server" /> <div id="footer"> </div> </div> </div> <%= Html.Telerik().ScriptRegistrar().DefaultGroup(group => { group.Add("telerik.common.js"); // That file is always required group.Add("telerik.treeview.js"); }) %></body></html>HomeController.cs
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using Telerik.Web.Mvc.UI;namespace TestTelerikTreeView.Controllers{ [HandleError] public class HomeController : Controller { public ActionResult Index() { ViewData["Message"] = "Welcome to ASP.NET MVC!"; return View(); } public ActionResult About() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Test(List<TreeViewItem> ti) { return null; } }}