Im Using ASp.Net Mvc , Here I'm displaying the tree View data ..My all functions are working But I want to pass only ID As a querystring ..and on the basis of Id. i want to load the data from the model and pass it tothe controller and store it in a viewbag.
<div class="widget-body">
<div class="widget-main padding-8">
<div id="accordion" class="accordion-style1 panel-group">
@{int i = 0;} @foreach (var item in Model) {
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-target="#collapseOne_@i"
aria-expanded="true"><i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down"
data-icon-show="ace-icon fa fa-angle-right"></i> @item.ServiceTypeName
@*Group Item #1*@ </a>
</h4>
</div>
<div class="collapse" id="collapseOne_@i" aria-expanded="true" style="">
<div class="panel-body">
@{ List<greytrix.selfservice.shared.models.servicesubtype> SubServicetype = (List<Greytrix.SelfService.Shared.Models.ServiceSubType>)ViewBag.SubService;
foreach (var SubService in SubServicetype.Where(a => a.ServiceTypeCode == item.ServiceTypeCode))
{
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="" data-parent="#accordion" aria-expanded="true" href="@SubService.RedirectLink?SubServiceID=@SubService.ServiceSubTypeCode">
<i class="ace-icon fa fa-angle-right bigger-110" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i>
@SubService.ServiceSubTypeName
</a>
</h4>
</div>
</div>
} }
</div>
</div>
</div>
i++; }
</div>
</div>
</div>
controller
var ServiceTypes = ticketsService.GetServices(Tenant.SchemaName);
ViewBag.SubService = ticketsService.GetSubServices(Tenant.SchemaName);
return View(ServiceTypes);
public class ServiceSubType
{
public int ID { get; set; }
public int ServiceTypeCode { get; set; }
public int ServiceSubTypeCode { get; set; }
public string ServiceSubTypeName { get; set; }
public string RedirectLink { get; set; }
}