TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nilesh Patil
NA
3k
114.8k
There is no ViewData item of type 'IEnumerable<SelectListIte
May 23 2018 1:45 AM
I am calling Report/Index from User/Index
Here is my code
Report Controller
[Authorize]
public ActionResult Index()
{
ZipcodesDataHelper zipData = new ZipcodesDataHelper();
ViewBag.ZipList = new SelectList(zipData.xperdev_scanner().Distinct(), "zip", "primary_city");
TourDataHelper tourData = new TourDataHelper();
ViewBag.TourList = new SelectList(tourData.RetrieveDefaultTourData().OrderBy(m=>m.Tour_Name), "Tour_ID", "Tour_Name");
EventDataHelper eventData = new EventDataHelper();
ViewBag.EventList = new SelectList(eventData.GetEventListwithDefaultAll(tourData.RetrieveDefaultTourData().OrderBy(m => m.Tour_Name).FirstOrDefault().Tour_Id).OrderBy(m=>m.Event_Name), "Event_Id", "Event_Name");
return View();
}
Index View
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_MainLayout.cshtml";
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script>
$(document).ready(function () {
$('#datetimepicker2').datepicker({
dateFormat: 'dd-mm-yy',
altField: '#thealtdate',
altFormat: 'yy-mm-dd'
});
$('#datetimepicker1').datepicker({
dateFormat: 'dd-mm-yy',
altField: '#thealtdate',
altFormat: 'yy-mm-dd'
});
var value = 0
$("#myimg").click(function () {
$("#showorhide").toggle();
value +=180;
$(this).rotate({ animateTo:value});
});
});
</script>
<script>
function getRegisterationView() {
// selectedEvent when event option is selected
if ($('#eventList :selected').length > 0) {
var selectednumbers = [];
var selectedEvent;
$('#eventList :selected').each(function (i, selected) {
selectednumbers.push($(selected).val());
});
selectedEvent = selectednumbers.join(",");
}
// selectedtour when All event in selected tour option is selected
if ($('#TourList :selected').length > 0) {
var selectedtournumbers = [];
var selectedtour;
$('#TourList :selected').each(function (i, selected) {
selectedtournumbers.push($(selected).val());
});
selectedtour = selectedtournumbers.join(",");
}
var dupCnt = $('#txtDup').val();
// startDate = $('#datetimepicker1').val();
// endDate = $('#datetimepicker2').val();
$.ajax({
url: getUrlForRegisteration,
contentType: "application/html; charset=utf-8",
data: {
eventid: selectedEvent,
tourid: selectedtour,
dupCount: dupCnt
},
type: "GET",
dataType: "html"
})
.success(function (result) {
$('#dvRegisteration').html(result);
})
.error(function () {
});
}
function myfun() {
$(".my_spinner").show("my_spinner");
}
</script>
<style>
.my_spinner {
text-align: center;
display: none;
padding: 80px 0px 0px 0px;
transition: all 0.4s ease-out;
}
.my_spinner img {
width: 6%;
}
img#myimg {
border: 1px solid #2d8dff;
padding: 5px;
min-height: 20px !important;
max-width: 25px;
max-height: 25px;
margin: 15px 0 0 16px;
}
.search_btn button#btnsearch {
padding: 10px 50px;
}
.search_btn {
text-align: center;
}
.content_tab_div_lable_div {
column-count: 5;
column-gap: 10px;
border: 1px solid #ccc;
margin: 16px;
border-radius: 5px;
padding: 10px;
line-height: 2;
}
.content_tab_div_lable_div label:first-child {
position: relative;
left: 10px;
}
span.fa.fa-check {
border: 1px solid #a0a0a0;
margin-right: 5px;
}
.page-breadcrumbs {
display: none;
}
nav.navbar.navbar-default {
display: none;
}
</style>
<script>
var getUrlForRegisteration = "@(Url.Action("Registeration","Report"))";
var eventUrl = "@(Url.Action("getEventList", "Report"))";
var tourUrl = "@(Url.Action("getTourList", "Report"))";
</script>
<script>
$(document).on('click', '#btnsearch', function () {
// alert(1);
getRegisterationView();
this.disabled = true;
});
</script>
<div class="widget" >
<div class="widget-header bg-themeprimary ">
<div class="widget-buttons">
<a href="#" data-toggle="maximize">
<i class="fa fa-expand"></i>
</a>
<a href="#" data-toggle="collapse">
<i class="fa fa-minus"></i>
</a>
</div><!--Widget Buttons-->
</div><!--Widget Header-->
<div class="widget-body" style="padding-bottom:40px">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="report_heading">
<h2>Event Reporting</h2>
@*<p>Click to select a tour based on the available list. once a tour is selected the below table is populated with the information</p>*@
</div>
</div>
</div>
<div>
</div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="report_heading">
<h4>Duplicate Threshold</h4>
<input type="text" id="txtDup" value="10" />
@*<p>Click to select a tour based on the available list. once a tour is selected the below table is populated with the information</p>*@
</div>
</div>
</div>
<div>
</div>
<div class="row content_tab_div">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="report_filter_box_header col-md-12">
<h4>Tour</h4>
@Html.DropDownList("TourList", (IEnumerable<SelectListItem>)ViewBag.TourList, new { @class = " form-control", @onChange = "fillEvent();" })
</div>
@*<div class="report_filter_box_header col-md-3">
<h4>From Date</h4>
<div class="form-group">
<div class='input-group date'>
<input id='datetimepicker1' type='text' class="form-control" />
<span class="input-group-addon" onclick="setCalendar()">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<div class="report_filter_box_header col-md-3">
<h4>To Date</h4>
<div class='input-group date'>
<input type='text' id='datetimepicker2' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>*@
</div>
</div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="report_filter_box_header col-md-12">
<h4>Event</h4>
@Html.DropDownList("eventList", (IEnumerable<SelectListItem>)ViewBag.EventList, new { @class = "report_filter_tour_list form-control ", @id = "eventList" })
</div>
</div>
</div>
@*<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="report_filter_box_header col-md-6">
<h4>Report Type</h4>
<select id="reportTypeList" class="form-control">
<option value="">Choose Report Type</option>
<option value="Daily Breakout (Show Multi-Day)">Daily Breakout (Show Multi-Day)</option>
<option value="Event Summary">Event Summary</option>
<option value="Activity Report">Activity Report</option>
<option value="Device Data">Device Data</option>
<option value="Test Leads">Test Leads</option>
</select>
</div>
<div class="report_filter_box_header col-md-6">
<h4>Preset</h4>
<select id="presetList" class="form-control">
<option value="Preset Filters">Preset Filters</option>
<option value="FFS">FFS</option>
<option value="RDS">RDS</option>
<option value="PCG Campbell">PCG Campbell</option>
<option value="Dealerizations">Dealerizations</option>
<option value="CCV2">CCV2</option>
<option value="MA">MA</option>
</select>
</div>
</div>
</div>*@
</div>
<div class="arrow_img row content_tab_div">
</div>
@*<div class="arrow_img row content_tab_div">
<img src="~/Content/Image/arrows.png" height="35" width="35" border="0" alt="" id="myimg" name="myimg" />
</div>*@
@*<div class="row content_tab_div" id="showorhide">
<div class="content_tab_div_lable_div">
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Customized" checked="">
<span class="fa fa-check"></span>Include Pre-Registrations
</label>
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Gifs" checked="">
<span class="fa fa-check"></span>Include Opt-Ins
</label>
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Videos" checked="">
<span class="fa fa-check"></span>Include Multi-Lingual Data
</label>
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Customized" checked="">
<span class="fa fa-check"></span>Include Pre-Registrations
</label>
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Gifs" checked="">
<span class="fa fa-check"></span>Include Handraisers
</label>
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Videos" checked="">
<span class="fa fa-check"></span>Include Paper Lead-Data
</label>
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Customized" checked="">
<span class="fa fa-check"></span>Include Brochure Counts
</label>
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Gifs" checked="">
<span class="fa fa-check"></span>Include Error Record Count
</label>
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Videos" checked="">
<span class="fa fa-check"></span>Number of Unique Leads Requesting Brochure
</label>
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Customized" checked="">
<span class="fa fa-check"></span>Include Non-Verified Emails
</label>
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Gifs" checked="">
<span class="fa fa-check"></span>Include Handraisers
</label>
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Videos" checked="">
<span class="fa fa-check"></span>Include Avg. Brochure Requests Per Lead
</label>
<label class="checkbox-inline c-checkbox">
<input id="chktype" type="checkbox" class="chktype" value="Gifs" checked="">
<span class="fa fa-check"></span>Include Test Leads
</label>
</div>
</div>*@
<div class="row content_tab_div search_btn">
<button type="button" class="btn btn-success 2x " onclick="myfun()" id="btnsearch">Generate Report</button>
</div>
<div class="my_spinner">
<img src="~/Content/Image/spinner-gif.gif" />
</div>
</div>
</div>
<div class="widget">
<div class="widget-body">
<div class="row content_tab_div">
<div class="col-md-12 col-sm-12 col-xs-12 Cls-dvreg">
<div id="dvRegisteration"></div>
</div>
</div>
</div>
</div>
<script>
function fillEvent() {
// alert(1);
var selText = $("#TourList option:selected").val();
// alert(selText);
$.ajax({
url: eventUrl,
type: "GET",
data: { tourCode: selText },
dataType: "JSON",
success: function (country) {
//var data = JSON.parse(country);
//alert(data);
$("#eventList").html("");
// clear before appending new list
$.each(country, function (i, ctry) {
$("#eventList").append(
$('<option></option>').val(ctry.event_id).html(ctry.event_name));
});
// getIntercallInfo();
}
});
}
function fillTour() {
// alert(1);
//var selText = $("#ZipList option:selected").val();
// alert(selText);
$.ajax({
url: tourUrl,
type: "GET",
//data: { zipCode: selText },
dataType: "JSON",
success: function (tour) {
//var data = JSON.parse(country);
//alert(data);
$("#tourList").html("");
// clear before appending new list
$.each(tour, function (i, tur) {
$("#tourList").append(
$('<option></option>').val(tur.tour_id).html(tur.tour_name));
});
// getIntercallInfo();
}
});
}
</script>
<script src="~/Content/A4team/js/reports.js"></script>
<script src="//cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.flash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.print.min.js"></script>
Reply
Answers (
3
)
Need to add Dropdown in Excel using ASP.NET CORE 2.0
Cannot implicitly convert type 'void' to 'string'