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
Ratheesh Palani
NA
73
939
search data not being displayed after search
Dec 27 2017 4:10 AM
> search data not being displayed after search using ajax in mvc..data binding also completed but display is not done
<section class="card ">
<div class="card-block">
<div class="row">
@*<div class="col-lg-3">
<fieldset class="form-group">
<label class="form-label semibold control-label">Generic Name</label>
@Html.DropDownList("MasterGenericID", null, "--- Select Therapeutic ---", new { @class = "select2-arrow" })
</fieldset>
</div>*@
<div class="col-lg-3">
<fieldset class="form-group">
<label class="form-label semibold control-label">Therapeutic Name</label>
@Html.DropDownList("MasterTherapeuticID", null, "--- Select Therapeutic ---", new { @class = "select2-arrow" })
</fieldset>
</div>
<div class="col-lg-3">
<fieldset class="form-group">
<label class="form-label semibold control-label">SubTherapeutic Name</label>
@Html.DropDownList("MasterSubTherapeuticID", null, "--- Select Therapeutic ---", new { @class = "select2-arrow" })
</fieldset>
</div>
<div class="col-lg-3">
<fieldset class="form-group">
<label class="form-label semibold control-label">Formulation Name</label>
@Html.DropDownList("MasterFormulationID", null, "--- Select Therapeutic ---", new { @class = "select2-arrow" })
</fieldset>
</div>
</div>
<br />
<table id="table"
class="table table-striped"
data-toolbar="#toolbar"
data-search="true"
data-show-refresh="true"
data-show-toggle="true"
data-show-columns="true"
data-show-export="true"
data-detail-view="true"
data-detail-formatter="detailFormatter"
data-minimum-count-columns="2"
data-show-pagination-switch="true"
data-pagination="true"
data-id-field="id"
data-page-list="[10, 25, 50, 100, ALL]"
data-show-footer="false"
data-response-handler="responseHandler">
<tr>
<th>BrandName</th>
<th>GenericName</th>
<th>TherapeuticName</th>
<th>PcompanyNAme</th>
<th>Formulation</th>
<th>MRP</th>
</tr>
<tbody>
@foreach (var item in @Model.Products)
{
<tr>
<td>@item.BrandName</td>
<td>@item.GenericName</td>
<td>@item.TherapeuticName</td>
<td>@item.PcompanyNAme</td>
<td>@item.Formulation</td>
<td>@item.MRP</td>
</tr>
}
</tbody>
<tfoot>
<tr>
<td colspan="5">
<div class="pagination">
<ul>
@for (int pagenum = 1; pagenum <= Model.PagerCount; pagenum++)
{
<li class="active"><a href="@Url.Action("ProductMasterview", "ProductMaster", new { pageNumber = @pagenum })" aria-controls="example" data-dt-idx="2" tabindex="0">@pagenum</a></li>
}
</ul>
</div>
</td>
</tr>
</tfoot>
</table>
</div>
</section><!--.box-typical-->
@section scripts{
<script src="~/js/lib/bootstrap-table/bootstrap-table.js"></script>
<script src="~/js/lib/bootstrap-table/bootstrap-table-export.min.js"></script>
<script src="~/js/lib/bootstrap-table/tableExport.min.js"></script>
<script>
$(document).ready(function () {
$("#btnsearch").click(function (e) {
e.preventDefault();
var TherapeuticID = $('#MasterTherapeuticID').val();
var SubTherapeuticID =$('#MasterSubTherapeuticID').val();
var FormulationID = $('#MasterFormulationID').val();
var Conurl = '@Url.Action("ProductMasterview", "ProductMaster")' + '?TherapeuticID=' + TherapeuticID + "&SubTherapeuticID=" + SubTherapeuticID + "&FormulationID=" + FormulationID;
$.ajax({
type: 'POST',
url: Conurl,
data: JSON.stringify(Conurl),
dataType: 'json',
success: function () {
alert("Search Completed!");
}
});
});
});
</script>
}
public ActionResult ProductMasterview(int? TherapeuticID, int? FormulationID, int? SubTherapeuticID, int? pageNumber)
{
if (TherapeuticID > 0 || FormulationID > 0 || SubTherapeuticID > 0)
{
//Generic_Bind();
Therapeutic_Bind();
SubTherapeutic_Bind();
Formulation_Bind();
Productmaster model = new Productmaster();
model.PageNumber = (pageNumber == null ? 1 : Convert.ToInt32(pageNumber));
model.PageSize = 25;
List<Productmaster> products = dPMSP.GetAllProductsUsingGenericID(TherapeuticID);
if (products != null)
{
model.Products = products.OrderBy(x => x.ProductID)
.Skip(model.PageSize * (model.PageNumber - 1))
.Take(model.PageSize).ToList();
model.TotalCount = products.Count();
var page = (model.TotalCount / model.PageSize) - (model.TotalCount % model.PageSize == 0 ? 1 : 0);
model.PagerCount = page + 1;
}
var data = new { products = products, Model = model };
return View(model);
}
else
{
//Generic_Bind();
Therapeutic_Bind();
SubTherapeutic_Bind();
Formulation_Bind();
Productmaster model = new Productmaster();
model.PageNumber = (pageNumber == null ? 1 : Convert.ToInt32(pageNumber));
model.PageSize = 25;
List<Productmaster> products = dPMSP.GetAllProducts();
if (products != null)
{
model.Products = products.OrderBy(x => x.ProductID)
.Skip(model.PageSize * (model.PageNumber - 1))
.Take(model.PageSize).ToList();
model.TotalCount = products.Count();
var page = (model.TotalCount / model.PageSize) - (model.TotalCount % model.PageSize == 0 ? 1 : 0);
model.PagerCount = page + 1;
}
var data = new { products = products, Model=model };
return View(model);
}
}
Reply
Answers (
0
)
Confirming valid HTML tags in file using a stack C#?
How to Print report.rdlc with print document ...?