this is my controller action method
public ActionResult GetAppComp(int id, string name, int cloudType, string appCompID)
{
var appComp = db.ApplicationComponents.ToList();
var model = appComp.Where(p => p.ApplicationID == id).ToList();
ViewBag.ApplicationComponent = db.ApplicationComponents.Where(p => p.ApplicationID == id).ToList();
ViewBag.ApplicationName = db.Applications.Where(p => p.ApplicationID == id).FirstOrDefault();
ViewBag.ApplicationID = db.ApplicationComponents.Select(p => p.ApplicationID);
return PartialView("_TechnicalFitment", model);
}
from this action method I am trying to pass the data to Partial View i.e. "_TechnicalFitment" through view bag, as my viewbag is taking all the values.
In my partial view I need to populate the list of Application Component in a div i.e.
<div id="surveyProgress" class="surveyProgress">
</div>
I am using a jquery
<script>
process();
function process(){
var appComp=@Viewbag.ApplicationComponent ;
$('#surveyProgress').append('<ul></ul>');
for (var i = 0; i<appComp.length; i++ ) {
$('#surveyProgress'+ '> ul' ).append('<li class="AppComponent-' + i + '"> <span>'+ appComp[i].name</span></li>');
}
</script>
But I cant fetch the list of components in div. Help!!