@model project_name.Models.SearchBrochureVM
ViewBag.Title = "Brochure_Create";
Layout = "~/Views/Shared/_Layout.cshtml";
<h4>Product Brochure Generation</h4>
@using (Html.BeginForm())
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group"></div>
@Html.LabelFor(m => m.Type, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownListFor(m => m.Type, Model.TypeList, "Select the type", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Type, "", new { @class = "text-danger" })
@Html.LabelFor(m => m.Category, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownListFor(m => m.Category, Model.CategoryList, "Select the category", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Category, "", new { @class = "text-danger" })
@Html.LabelFor(m => m.Country, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownListFor(m => m.Country, Model.CountryList, "Select the country", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Country, "", new { @class = "text-danger" })
@Html.LabelFor(m => m.Product, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownListFor(m => m.Product, Model.ProductList, "Select the subsidary", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Product, "", new { @class = "text-danger" })
<div class="col-md-offset-2 col-md-10">
<button id="search" type="button" class="btn btn-success submit">Select Information</button>
<tbody id="table"></tbody>
<table id="template" class="table" style="display: none;">
<input type="hidden" name="[#].Property_ID" />
<input type="checkbox" name="[#].IsChecked" value="true"/>
<input type="hidden" name="[#].IsChecked" value="false"/>
<div style="width:50%; float:left;text-align:left"><button id="resetborchure" type="button" class="btn btn-warning submit">Reset Brochure</button> </div>
<div style="width:50%; float:left;text-align:right"><button id="createborchure" type="button" class="btn btn-danger submit">Create Brochure</button> </div>
<script type="text/javascript">
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/jqueryui")
<script type="text/javascript">
var category = $('#Category');
var country = $('#Country');
var product = $('#Product');
$('#search').click(function () {
var url = '@Url.Action("FetchProductProperties")';
$.getJSON(url, { type: type.val(), category: category.val(), country: country.val(), product: product.val() }, function (data) {
$.each(data, function (index, item) {
var clone = $('#template').clone();
clone.html($(clone).html().replace(/\[#\]/g, '[' + index + ']'));
var cells = clone.find('td');
cells.eq(0).children('span').text(item.ID);
cells.eq(0).children('input').val(item.ID);
cells.eq(1).children('input').first().prop('checked', item.CheckOrNot)
cells.eq(2).children('span').text(item.Name);
$('#table').append(clone.find('tr'));
$('#createborchure').click(function () {
var data = $('#brochureform').serialize();
var url = '@Url.Action("Create_Brochure")';
$.get(url, data, function (result) {
$('#resetborchure').click(function () {