Posts

Showing posts with the label JQuery

How to Preview the image and download which is in base64string format in mvc view using C#

  <div class="col-lg-9 col-xl-6">                                                     @if (reclaimdetai != null)                                                     {                                                         @foreach (var item in reclaimdetai.RequestFileList)                                                         {                                 ...

How to Change Layout based on viewbag value in mvc view using Mvc,C#

 @{     if (@ViewBag.lang == "en")     {         Layout = "Layout Name 1"; //This content uses above layout     }     if (@ViewBag.lang == "ar")     {         Layout = "Layout Name 2"; //This content uses above layout     } }

How to Get the current url and redirect to other url(case:button click english to arabic screen using parameter in url) using jquery,mvc,c#

   <a class="btn btn-icon btn-clean btn-lg w-40px h-40px btnlang" id="btnlang" > Change Lang </a> sample url:  https://localhost:44310/Claims/AddClaim?lang=en <script src="~/lib/jquery/dist/jquery.min.js"></script> <script>     $(document).ready(function () {         $('.btnlang').click(function () {             debugger;             var pageURL = $(location).attr("href");//gets the current url             var baseaddress = pageURL.substring(0, pageURL.indexOf('?'));//get the base address before '?'             var tech = getUrlParameter('lang');//gets the parameter using parameter name i.e,lang             if (tech == "en") {                 location.href = baseaddress + "?lang=ar";             }...

How to write Function to validate input password pattern in mvc using Jquery

 function validatepin(cpin) {     //var paswd = /^(?=.*\d)(?=.*[^a-zA-Z0-9])(?!.*\s).{8,8}$/;     if (containsCharacters(cpin) && containsNumber(cpin) && containsSpecialCharacters(cpin)) {                return true;     } else {                return false;     } } function containsCharacters(val) { var regex = /[A-z]/; var isValid = regex.test(val); return isValid; } function containsNumber(val) { var regex = /[0-9]/; var isValid = regex.test(val); return isValid; } function containsSpecialCharacters(val) { var regex = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/; var isValid = regex.test(val); return isValid; }

Implement virtualisation in kendo drop down list using jquery ajax in mvc, aspx page

virtualization helps to load huge data fastly. $("#abcd").kendoDropDownList({                 filter: "contains",                 dataTextField: "WorkOrderNumber",                 dataValueField: "WorkOrderNumber",                 virtual: {                     itemHeight: 26,                     valueMapper: function (options) {                     }     ...

How to get row data in kendo grid when button is clicked

Let us consider their is a edit button in kendo  grid as shown below ex:           {                     command: [{                         name: "edit",                         className: "btn-Edit",                         text: "Edit", click: btnEdit                     }], title: "Action", media: "(min-width: 500px)", width: "220px"                 } Now In btnEdit() function we get the button clicked row data using jquery as shown, ex:      function btnEdit(e) {             var grid = $("#gridName").getKendoGrid();             var item = grid.d...

How to add button in kendo grid using jquery

Below code can be used to add a button in kendo grid.  ex:           {                     command: [{                         name: "edit",                         className: "btn-Edit",                         text: "Edit", click: btnEdit                     }], title: "Action", media: "(min-width: 500px)", width: "220px"                 } In the above code, className :- Defines the css class name text :- Text displayed on button click :- Function to be called when clicked on button title:- Text displayed as grid column header In this example we are calling btnEdit function on clicked, function b...

How to show loading effect in kendo grid using jquery

The below line can be used to show the loading effect for your grid,  kendo.ui.progress($("#YourGridId"), true); To stop the loading effect you can use the below line  kendo.ui.progress($("#YourGridId"), false);

How to select default value on loading dynamic kendo dropdownlist

//calling the below function to get the weekendingdates from database using ajax call ex:  function GetWeekEndingDates() {             $.ajax({                 type: 'GET',                 url: "WS_Equipment.asmx/GetWeekendingDate",                 dataType: "json",                 success: function (jsonData) {                     var i = JSON.parse(JSON.stringify(jsonData));                     if (jsonData != null) {                         WeekDates = i.WeekEndingDates;                         LastWeekDate = i.LastWeekEndingDate;         ...

How to show or bind dynamic data to kendo grid using jquery in mvc view,aspx?

    <script> $(document).ready(function () {             $("#ListViewGrid").kendoGrid({                 dataSource: {                     transport: {                         read: {                             url: 'WS_Equipment.asmx/ListView',                             dataType: 'json'                         }                     },                     schema: {                         model: {     ...

How to extract or retrieve parameter values from url using jQuery?

Let us consider the following sample Url, from which we want to extract the parameter values. window.location.href = "./EquipmentCostList.aspx?headerId=" + 123+"&WorkOrderNumber="+123+"&WeekEndindDate="+2019/08/12; If we see the above sample url we can find the parameters like headerId,WorkOrderNumber,etc.. So, to extract these parameter values from the url, we can easily write some jQuery code as shown below, jQuery Code : $(document).ready(function () { //below method is used to retrieve the single parameter value based the parameter name sent.             var getUrlParameter = function getUrlParameter(sParam) {                 var sPageURL = window.location.search.substring(1),                     sURLVariables = sPageURL.split('&'),                     sParameterName,           ...

How to Show multiple kendo grids using dynamic data in Html using Jquery

1.Declare a div element to bind the gird ex:   <div class="container-fluid">                <div id="Equipmentgrid"></div>          </div> 2. Get the data using ajax call ex: <script>         var EquipmentData;         var EmployeeDat;                 $.ajax({                     type: 'GET',                     url: "WS_Equipment.asmx/GetEquipmentData",                     data: { WeekendingDate: WeekendingDate, WorkOrderId: WorkOrderId },                     dataType: "json",                     success: function (jsonData) {    ...

How to bind remote data from DB to kendo dropdownlist using Jquery in C#

Let us consider the below example, Step 1 : Consider the below textbox for which we want to bind dropdownlist using kendo. Sample code : <div class="col-md-3">           <label for="validationServer01" style="color: #6f90a3">Week Ending Date</label>                                       <input id="products" style="width: 270px" />  </div> Step 2 : Let's write the Jquery script to get the dropdown list from webservice and bind it to input element  and initialize kendo dropdown. Sample code: <script>         $(document).ready(function () {             $("#products").kendoDropDownList({                 filter: "contains",                 optionLabel: "Select Week...