Random number is not refreshed on submit - html

I have a random number generator (for voucher numbers), but when I click the button, a new random number is not shown. Can anyone help please?
This is my controller that generates the random number:
static Random random = new Random();
public List<string> RandomVouchers()
{
int vouchersToGenerate = 1;
int lengthOfVoucher = 10;
List<string> generatedVouchers = new List<string>();
char[] keys = "ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".ToCharArray();
while (generatedVouchers.Count < vouchersToGenerate)
{
string voucher = GenerateVoucher(keys, lengthOfVoucher);
if (!generatedVouchers.Contains(voucher))
{
generatedVouchers.Add(voucher);
return generatedVouchers;
}
}
return generatedVouchers;
}
private static string GenerateVoucher(char[] keys, int lengthOfVoucher)
{
return Enumerable
.Range(1, lengthOfVoucher) // for(i.. )
.Select(k => keys[random.Next(0, keys.Length - 1)]) // generate a new random char
.Aggregate("", (e, c) => e + c); // join into a string
}
This is the orders page :
<div id="vouchercode" style="display:none">
<ul>
#foreach (string strVouchers in ViewBag.Vouchers)
{
<li>#strVouchers</li>
}
</ul></div>
<button id="getvoucher">GenerateVoucher</button>
This is javascript code:
<script type="text/javascript">
$(function () {
$("#getvoucher").click(function () {
$("#vouchercode").dialog({
width: 460,
height: 200,
modal: true,
});
});
});

Related

Knockout Foreach creating duplicate items

On our UI, we have classrooms that are eligible for assessments. After creating and adding in eligibleclassrooms, I am getting duplicates of each classroom type. The expected output is one of each classroom.
Relavant HTML:
<div class="eligible-classrooms">
<h5 class="semi-bold btm-gap-sm">Eligible Classrooms</h5>
<div class="classrooms">
<!-- ko foreach: model.sortedEligibleClassrooms -->
<div class="classroom">
<span data-bind="text: $data.ageRangeTypeName"></span><span class="count" data-bind="text: $data.numClassrooms"></span>
</div>
<!-- /ko -->
</div>
</div>
Relevant Typescript:
Model:
numberOfEligibleClassrooms: KnockoutObservableArray<{ ageRangeTypeId: number, ageRangeTypeName: string, numClassrooms: number }>,
sortedEligibleClassrooms: KnockoutComputed<Array<{ ageRangeTypeId: number, ageRangeTypeName: string, numClassrooms: number }>>
self.model:
numberOfEligibleClassrooms: ko.observableArray([]),
sortedEligibleClassrooms: null,
constructor(orgCaseId: number, observationType: ObservationTypeModel, orgObservationSetTypeId: number) {
var self = this;
self.model.sortedEligibleClassrooms = ko.computed(function () {
return self.model.numberOfEligibleClassrooms().sort((left: { ageRangeTypeId: number, ageRangeTypeName: string, numClassrooms: number }, right: { ageRangeTypeId: number, ageRangeTypeName: string, numClassrooms: number }): number => {
return left.ageRangeTypeId > right.ageRangeTypeId ? 1 : -1;
});
}, self.model.numberOfEligibleClassrooms);
self.load = (): void => {
CommonFactory.AppSettings.get('OrgClassroomCollectMajorityAgeRange', function (setting: IApplicationSetting) {
const majorityAgeRangeEnabled = setting ? setting.value.toString().toLowerCase() === 'true' : false;
OrgFactory.ObservationTypeAgeRangeTypes.search({ "observationTypeId": self.model.observationType.id(), isCount: true }, function (ageRangeTypes) {
for (var j = 0; j < ageRangeTypes.length; j++) {
// The following function preserves the scope of the variables
(function (ageRangeTypeId, ageRangeTypeName) {
var minimumAgeRangeTypeId = self.settings.isERSObservation() ? ageRangeTypeId : null;
var search = {
minimumAgeRangeTypeId: minimumAgeRangeTypeId,
includesAgeRangeTypeId: majorityAgeRangeEnabled ? null : ageRangeTypeId,
majorityAgeRangeTypeId: majorityAgeRangeEnabled ? ageRangeTypeId : null,
isCount: true
};
OrgFactory.OrgCase.getEligibleObservationClassrooms(orgCaseId, search, function (data) {
self.model.numberOfEligibleClassrooms.push({ ageRangeTypeId: ageRangeTypeId, ageRangeTypeName: ageRangeTypeName, numClassrooms: data.length });
});
})(ageRangeTypes[j].ageRangeTypeId, ageRangeTypes[j].ageRangeTypeName);
}
});
});
}
Output:
What I did to fix this is create a distinctEligibleClassrooms method that distinctly sorts through the list of eligible classrooms:
//creates a distinct array of eligible classrooms.
self.model.distinctEligibleClassrooms = ko.computed(function () {
const classrooms = self.model.numberOfEligibleClassrooms();
const seen = {};
const distinctClassrooms = classrooms.filter(classroom => {
if (!seen[classroom.ageRangeTypeId]) {
seen[classroom.ageRangeTypeId] = true;
return true;
}
return false;
});
return distinctClassrooms;
}, self.model.numberOfEligibleClassrooms);
I added this directly under the current sortedEligibleClassrooms method and removed that because it will no longer be in use.

Jstree more than 2 level tree

I have a system Every user has role and Id And some user has parent , i want to show this tree by Jstree but when I fetch data from database, just show 2 level for me,how can i expand it to show whole tree in my system?
This is My Action In Controller:
public async Task<IActionResult> Index2Async()
{
List<TreeViewNode> nodes = new List<TreeViewNode>();
//Loop and add the Parent Nodes.
//get roots
foreach(var user in userManager.Users)
{
var checkUserIsEmployee = applicationDbContext.EmployeeInRoles.Where(s => s.UserId == user.Id).ToList().Count;
if (checkUserIsEmployee>0)
{
continue;
}
else
{
nodes.Add(new TreeViewNode { id = user.Id, parent = "#", text = user.Name + " " + user.Family });
}
}
//end get roots
//Loop and add the Child Nodes.
//get child
foreach (var user in userManager.Users)
{
var Employee = applicationDbContext.EmployeeInRoles.ToList();
foreach (var item in Employee)
{
if (user.Id == item.UserId)
{
var ParentRole = roleManager.Roles.SingleOrDefault(s => s.Id == item.RoleId);
foreach(var parent in userManager.Users)
{
if (await userManager.IsInRoleAsync(parent, ParentRole.Name))
{
nodes.Add(new TreeViewNode { id = user.Id + "-" + parent.Id, parent = parent.Id, text = user.Name+" "+user.Family });
}
}
}
}
}
//end get child
//Serialize to JSON string.
ViewBag.Json = JsonConvert.SerializeObject(nodes);
return View();
}
This is cshtml file (Index2):
<link rel="stylesheet" href="~/jstree/dist/themes/default/style.min.css" />
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/jstree/dist/jstree.min.js"></script>
<div style="color:#fff" id="jstree">
</div>
<form method="post" asp-controller="Admin" asp-action="Index2">
<input type="hidden" name="selectedItems" id="selectedItems" />
<input type="submit" value="Submit" />
</form>
<script type="text/javascript">
jQuery(function ($) {
$('#jstree').on('changed.jstree', function (e, data) {
var i, j;
var selectedItems = [];
var postedItems = [];
for(i = 0, j = data.selected.length; i < j; i++) {
//Fetch the Id.
var id = data.selected[i];
//Remove the ParentId.
if(id.indexOf('-') != -1){
id = id.split("-")[1];
}
//Add the Node to the JSON Array.
selectedItems.push({
text: data.instance.get_node(data.selected[i]).text,
id: id,
parent: data.node.parents[0]
});
}
//Serialize the JSON Array and save in HiddenField.
$('#selectedItems').val(JSON.stringify(selectedItems));
}).jstree({
"core": {
"themes": {
"variant": "large"
},
"data": #Html.Raw(ViewBag.Json)
},
"checkbox": {
"keep_selected_style": false
},
"plugins": ["wholerow", "checkbox"],
});
});
This is model:
public class TreeViewNode
{
public string id { get; set; }
public string parent { get; set; }
public string text { get; set; }
}
And the result is below:

How can i populate json data into charts using ajax call?

I want to pass json data to jsp and populate into the charts data. How can i do this?
Previously i am setting data value by sending each value using model attribute.
In EmployeeController i have lineBarChart method like this :-
#RequestMapping("/lineBar")
public String lineBarChart(Model model)
{
List<Employee> emp = employeeMapper.getAllEmployees();
int cseCount = 0;
int ecCount = 0;
int itCount = 0;
int cseSalary = 0;
int ecSalary = 0;
int itSalary = 0;
for (int j = 0; j < emp.size(); j++)
{
if (emp.get(j).getDepartment().equalsIgnoreCase("CSE"))
{
cseSalary += emp.get(j).getSalary();
cseCount++;
}
else if (emp.get(j).getDepartment().equalsIgnoreCase("IT"))
{
itSalary += emp.get(j).getSalary();
itCount++;
}
else
{
ecSalary += emp.get(j).getSalary();
ecCount++;
}
}
Map<Integer, Integer> map = new HashMap<>();
map.put(cseCount, cseSalary);
map.put(ecCount, ecSalary);
map.put(itCount, itSalary);
GsonBuilder gsonMapBuilder = new GsonBuilder();
Gson gsonObject = gsonMapBuilder.create();
String jsonObject = gsonObject.toJson(map);
System.out.println(jsonObject);
// Previously i am doing this now i want to send json to chart
model.addAttribute("cse", cseCount);
model.addAttribute("ec", ecCount);
model.addAttribute("it", itCount);
model.addAttribute("cseSalary", cseSalary);
model.addAttribute("itSalary", itSalary);
model.addAttribute("ecSalary", ecSalary);
return "lineBarChart";
}
Here is lineBarChart.jsp :-
<script>
$(function()
{
var lineBarChart = new CanvasJS.Chart("lineBarChartContainer",
{
animationEnabled: true,
theme: "light2",
title:
{
text: "Branch wise total Employee Salary",
fontSize: 20,
fontFamily: "Trebuchet MS",
fontWeight: "bold",
margin: 10
},
axisY:
{
title: "Number of Employee",
suffix: " K"
},
data:
[{
type: "column",
dataPoints:
[
{ y: ${cse}, label: "CSE" },
{ y: ${ec}, label: "EC" },
{ y: ${it}, label: "IT" }
]
},
{
type: "line",
toolTipContent: "{label}: {y}K",
showInLegend: true,
dataPoints:
[
{ y: ${cseSalary}/10000, label: "CSE" },
{ y: ${ecSalary}/10000, label: "EC" },
{ y: ${itSalary}/10000, label: "IT" }
]
}]
});
lineBarChart.render();
});
</script>
<div class="card shadow p-3 bg-white rounded">
<div class="card-body">
<div id="lineBarChartContainer" style="height: 240px; width: 100%;"></div>
</div>
</div>
I am calling lineBarChart.jsp file from another jsp using ajax call.
Like this :-
<div class="row" >
<div class="col-md-6 p-1">
<div id="lineBarGraph"></div>
</div>
</div>
$.ajax({url: "lineBar",
async: false,
success: function(result)
{
console.log(result);
$("#lineBarGraph").html(result);
}
});
You will need to create a 2nd handler method or controller.
The existing controller will simply load the JSP so all the logic can be removed from that. The new controller method will have the logic to load and return the data requested by your Ajax call and will look like the below.
Note the #ResponseBody annotation.
Update you Ajax call to request the new path fetchChartDataor whatever you want it to be:
#RequestMapping("/fetchChartData", produces="application/json")
public #ResponseBody String getChartData()
{
List<Employee> emp = employeeMapper.getAllEmployees();
int cseCount = 0;
int ecCount = 0;
int itCount = 0;
int cseSalary = 0;
int ecSalary = 0;
int itSalary = 0;
for (int j = 0; j < emp.size(); j++)
{
if (emp.get(j).getDepartment().equalsIgnoreCase("CSE"))
{
cseSalary += emp.get(j).getSalary();
cseCount++;
}
else if (emp.get(j).getDepartment().equalsIgnoreCase("IT"))
{
itSalary += emp.get(j).getSalary();
itCount++;
}
else
{
ecSalary += emp.get(j).getSalary();
ecCount++;
}
}
Map<Integer, Integer> map = new HashMap<>();
map.put(cseCount, cseSalary);
map.put(ecCount, ecSalary);
map.put(itCount, itSalary);
//you could remove the below and return the map directly
GsonBuilder gsonMapBuilder = new GsonBuilder();
Gson gsonObject = gsonMapBuilder.create();
return gsonObject.toJson(map);
}
You could simplify further by changing the method return type to Map<Integer, Integer> and return this directly. Spring Boot will handle the serialization to Json using the configured Json library:
https://www.callicoder.com/configuring-spring-boot-to-use-gson-instead-of-jackson/

MultipartMemoryStreamProvider and reading user data from MultiPart/Form Data

I have a file and user data that is being posted from Multipart/form data to a post method in my apicontroller class.
I am able to read the file without any problems but unable to read user data.
I tried couple of things like using model binding, passing the individual fields as a method parameter in the post method but i get: No MediaTypeFormatter is available to read an object of type 'FormDataCollection' from content with media type 'multipart/form-data'.
var provider = await Request.Content.ReadAsMultipartAsync(new MultipartMemoryStreamProvider());
foreach (var item in provider.Contents)
{
var fieldName = item.Headers.ContentDisposition.Name.Trim('"');
if (item.Headers.ContentDisposition.FileName == null)
{
var data = await item.ReadAsStringAsync();
if (fieldname == "name")
{
Name = data;
}
else
{
fileContents = await item.ReadAsByteArrayAsync();
}
}
}
Thanks.
It seems to me the OP, was really close. This is some code that tries to clearly show how to get the form variables, as well as the file upload data.
First the ApiController:
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
namespace WebApplication1.Controllers
{
public class FormAndFileDataController : ApiController
{
private class FormItem
{
public FormItem() { }
public string name { get; set; }
public byte[] data { get; set; }
public string fileName { get; set; }
public string mediaType { get; set; }
public string value { get { return Encoding.Default.GetString(data); } }
public bool isAFileUpload { get { return !String.IsNullOrEmpty(fileName); } }
}
/// <summary>
/// An ApiController to access an AJAX form post.
/// </summary>
/// <remarks>
///
/// </remarks>
/// <returns></returns>
public async Task<HttpResponseMessage> Post()
{
if (!Request.Content.IsMimeMultipartContent())
{
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
}
var provider = new MultipartMemoryStreamProvider();
await Request.Content.ReadAsMultipartAsync(provider);
var formItems = new List<FormItem>();
// Scan the Multiple Parts
foreach (HttpContent contentPart in provider.Contents)
{
var formItem = new FormItem();
var contentDisposition = contentPart.Headers.ContentDisposition;
formItem.name = contentDisposition.Name.Trim('"');
formItem.data = await contentPart.ReadAsByteArrayAsync();
formItem.fileName = String.IsNullOrEmpty(contentDisposition.FileName) ? "" : contentDisposition.FileName.Trim('"');
formItem.mediaType = contentPart.Headers.ContentType == null ? "" : String.IsNullOrEmpty(contentPart.Headers.ContentType.MediaType) ? "" : contentPart.Headers.ContentType.MediaType;
formItems.Add(formItem);
}
// We now have a list of all the distinct items from the *form post*.
// We can now decide to do something with the items.
foreach (FormItem formItemToProcess in formItems)
{
if (formItemToProcess.isAFileUpload)
{
// This is a file. Do something with the file. Write it to disk, store in a database. Whatever you want to do.
// The name the client used to identify the *file* input element of the *form post* is stored in formItem.name.
// The *suggested* file name from the client is stored in formItemToProcess.fileName
// The media type (MimeType) of file (as far as the client knew) if available, is stored in formItemToProcess.mediaType
// The file data is stored in the byte[] formItemToProcess.data
}
else
{
// This is a form variable. Do something with the form variable. Update a DB table, whatever you want to do.
// The name the client used to identify the input element of the *form post* is stored in formItem.name.
// The value the client input element is stored in formItem.value.
}
}
return Request.CreateResponse(HttpStatusCode.OK);
}
}
}
and the MVC View to test it:
#{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script type="text/javascript">
var hiddenForm, hiddenFile;
function initialize() {
// Use a hidden file element so we can control the UI
// of the file selection interface. The built in browser
// UI is not localizable to different languages.
hiddenFile = document.createElement("input");
hiddenFile.setAttribute("type", "file");
hiddenFile.setAttribute("style", "display: none;");
// We don't need the form really, but it makes it easy to
// reset the selection.
hiddenForm = document.createElement("form");
hiddenForm.appendChild(hiddenFile);
hiddenFile.onchange = function () {
var elementToUpdate = document.getElementById("fileNameToUpload");
var filesToUpload = hiddenFile.files;
var fileToUpload = filesToUpload[0];
elementToUpdate.value = fileToUpload.name;
}
document.body.appendChild(hiddenForm);
}
function chooseFile() {
hiddenFile.click();
}
function clearFile() {
var elementToUpdate = document.getElementById("fileNameToUpload");
elementToUpdate.value = "";
hiddenForm.reset();
}
function testAJAXUpload() {
// We are going to use the FormData object and jQuery
// to do our post test.
var formToPost = new FormData();
var formVariableNameElement = document.getElementById("variableNameToUpload");
var formVariableValueElement = document.getElementById("variableValueToUpload");
var formVariableName = formVariableNameElement.value || "formVar1";
var formVariableValue = formVariableValueElement.value || "Form Value 1";
var filesToUpload = hiddenFile.files;
var fileToUpload = filesToUpload[0];
formToPost.append(formVariableName,formVariableValue)
formToPost.append("fileUpload", fileToUpload);
// Call the Server.
$.ajax({
url: '#Url.HttpRouteUrl("DefaultApi", new { controller = "FormAndFileData" })',
type: 'POST',
contentType: false,
processData: false,
data: formToPost,
error: function (jqXHR, textStatus, errorThrown) {
alert("Failed: [" + textStatus + "]");
},
success: function (data, textStatus, jqXHR) {
alert("Success.");
}
});
}
</script>
</head>
<body>
<input id="variableNameToUpload" type="text" placeholder="Form Variable: Name" />
<br />
<input id="variableValueToUpload" type="text" placeholder="Form Variable: Value" />
<br />
<input id="fileNameToUpload" type="text" placeholder="Select A File..." /><button onclick="chooseFile()">Select File</button><button onclick="clearFile()">Reset</button>
<br />
<button onclick="testAJAXUpload()">Test AJAX Upload</button>
<script type="text/javascript">
initialize();
</script>
</body>
</html>
I had considered adding this to your other post per your comment, but (as you also decided), it is a separate question.
public async Task<HttpResponseMessage> Post()
{
if (!Request.Content.IsMimeMultipartContent())
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
try
{
string root = HttpContext.Current.Server.MapPath("~/App_Data");
var provider = await Request.Content.ReadAsMultipartAsync(new MultipartFormDataStreamProvider(root));
// file data
foreach (MultipartFileData file in provider.FileData)
{
using (var ms = new MemoryStream())
{
var diskFile = new FileStream(file.LocalFileName, FileMode.Open);
await diskFile.CopyToAsync(ms);
var byteArray = ms.ToArray();
}
}
// form data
foreach (var key in provider.FormData.AllKeys)
{
var values = provider.FormData.GetValues(key);
if (values != null)
{
foreach (var value in values)
{
Console.WriteLine(value);
}
}
}
return Request.CreateResponse(HttpStatusCode.Created);
}
catch (Exception ex)
{
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex);
}
}

Passing selected value of dropdownlist to a controller after postback

How to pass the selected value of a drop down list from view to controller after postback. As i'm new to the MVC architecture any help will be greatly appreciated. Thanks in advance.
I need to filter data based on the values of dropdown list. But when i move to the next page of pagedlist then all my dropdown list's value is set to default value.
Controller
public ActionResult ViewDataOfDatabase(string sortorder, string currentFilter, string searchString, int? page,FormCollection collection)
{
CCIRepository _repository = CCIRepository.CreateRepository();
AirtelManagementModel _Airtelmodel = new AirtelManagementModel();
IEnumerable<CityListClass> CityList = _repository.GetCities();
IEnumerable<SelectListItem> CityNames = from c in CityList
select new SelectListItem()
{
Value = c.CityName.ToString(),
Text = c.CityName.ToString(),
Selected = c.CityName == Request["CityNames"],
};
ViewBag.CityList = CityNames;
IEnumerable<clsYearOfDate> SelectList = GetYears();
//IEnumerable<MonthListClass> SelectMonthList = GetMonths(YearId);
IEnumerable<SelectListItem> Yearitems = (from v in SelectList
select new SelectListItem()
{
Value = v.YearSelectedId.ToString(),
Text = v.YearOfDate.ToString(),
Selected = v.YearOfDate == Request["Yearitems"],
});
ViewBag.SelectList = Yearitems;
int DateId=0;
string CityName = string.Empty;
try
{
int SelectedYear = Convert.ToInt16(collection["Yearitems"].ToString());
int SelectedMonth = Convert.ToInt16(collection["MonthItems"].ToString());
CityName = collection["CityNames"].ToString();
DateId = _repository.GetImportDateId(SelectedYear, SelectedMonth);
ViewBag.SelectedYear = SelectedYear;
ViewBag.SelectedMonth = SelectedMonth;
ViewBag.SelectedCity = CityName;
}
catch(NullReferenceException Ex)
{
Console.WriteLine(Ex);
}
//IEnumerable<SelectListItem> MonthItems = (from m in SelectMonthList
// select new SelectListItem()
// {
// Value = m.MonthSelectedId.ToString(),
// Text = m.MonthName,
// });
//ViewBag.SelectMonthList = MonthItems;
IEnumerable<SelectListItem> MonthItems = Enumerable.Empty<SelectListItem>();
ViewBag.SelectMonthList = MonthItems;
List<AirtelManagementModel> list = ViewDetails();
ViewBag.CurrentSort = sortorder;
ViewBag.PhoneSortParm = String.IsNullOrEmpty(sortorder) ? "Phone_desc" : "";
if (searchString != null )
{
page = 1;
}
else
{
searchString = currentFilter;
}
//if(searchString!=null)
//{
ViewBag.CurrentFilter = searchString;
var airteldetails = from _model in list
select _model;
if(!String.IsNullOrEmpty(searchString) && DateId!=0 && !String.IsNullOrEmpty(CityName))
{
airteldetails = _repository.FilterAirtelDetails(searchString, DateId, CityName);
int PageSize = 5;
int PageNumber = (page ?? 1);
return View(airteldetails.ToPagedList(PageNumber, PageSize));
}
//airteldetails=airteldetails.OrderByDescending(A=>A.AirtelNumber);
int pageSize = 5;
int pageNumber = (page ?? 1);
//return View(airteldetails.ToList());
return View(airteldetails.ToPagedList(pageNumber, pageSize));
}
View
<h2 style="text-align:center">AirtelDetails</h2>
#using (Html.BeginForm("ViewDataOfDatabase", "AirtelManagement",FormMethod.Post))
{
<h3>Search by PhoneNumber:#Html.TextBox("SearchString",ViewBag.CurrentFilter as string)</h3>
<p><h3>Year:#Html.DropDownList("Yearitems",(IEnumerable<SelectListItem>)ViewBag.SelectList, "Select Year")</h3>
<h3>Month:#Html.DropDownList("MonthItems", (IEnumerable<SelectListItem>)ViewBag.SelectMonthList, "Select Month")</h3>
<h3>City: #Html.DropDownList("CityNames", (IEnumerable<SelectListItem>)ViewBag.CityList, "Select City")</h3></p>
<p><input type="submit" value="Search" /></p>
<script>
$(document).ready(function () {
$("#Yearitems").change(function () {
//debugger;
//alert($("#Yearitems>option:selected").attr("Value"));
$.ajax({
type: "Post",
url: '#Url.Action("GetMonths","AirtelManagement")',
data: { YearId: $("#Yearitems>option:selected").attr("Value") },
datatype: "Json",
success: function (data) {
//debugger;
$("#MonthItems").html("");
$.each(data, function (index, item) {
$("#MonthItems").append(new Option(item.MonthName, item.MonthSelectedId));
});
},
error: function () {
alert("Select Year");
}
});
});
});
</script>
}
Page #(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of #Model.PageCount
#Html.PagedListPager(Model, page => Url.Action("ViewDataOfDatabase", "AirtelManagement", new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))