@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>
@using (Html.BeginForm("Create_Brochure", "Brochure", FormMethod.Get))
<tbody id="table"></tbody>
<div style="width:50%; float:right;text-align:right"> <input type="submit" class="btn btn-danger submit" value="Create Brochure" /> </div>
<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" />
<input type="hidden" name="[#].Property_Title" />
<input type="hidden" name="[#].Property_Value" />
<div style="width:50%; float:left;text-align:left"><button id="resetborchure" type="button" class="btn btn-warning submit">Reset Brochure</button> </div>
@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);
cells.eq(2).children('input').val(item.Name);
cells.eq(3).children('span').text(item.PropertyValue);
cells.eq(3).children('input').val(item.PropertyValue);
$('#table').append(clone.find('tr'));
$('#resetborchure').click(function () {