Skip to main content

Posts

Showing posts with the label Razor

MVC CheckBoxFor value set from script

If we want to set value in CheckBoxFor value from script we can set value like this: function EditAccessPrevilige(AccessPrivilegeID, LoginID, EmployeeAccessPrivilege, PayrollPrivilege) { $('#AccessPrivilegeInfo_LoginID').val(LoginID); if (EmployeeAccessPrivilege == "True") document.getElementById("AccessPrivilegeInfo_EmployeeAccessPrivilege").checked = true; else document.getElementById("AccessPrivilegeInfo_EmployeeAccessPrivilege").checked = false; if (PayrollPrivilege == "True") document.getElementById("AccessPrivilegeInfo_PayrollPrivilege").checked = true; else document.getElementById("AccessPrivilegeInfo_PayrollPrivilege").checked = false; return false; }

mvc razor selected datepicker will add 3 month in another datepicker

  Before select date  after select date if you want to select any date from a date picker and it will add 3 month / as your self  in another date picker, you can easily do it using script on change event of you first date picker. @Html.TextBoxFor(m => m.MaternityLeave.strSymptomDate, new { @class = "textRegular requiredSub dtPicker", @readOnly = "readOnly", maxlength = "10", onchange = "return getConfirmationDate();" }) second date picker @Html.TextBoxFor(m => m.MaternityLeave.strApplyDate, new { @class = "textRegular requiredSub dtPicker", @readOnly = "readOnly", maxlength = "10" }) on change event script function getConfirmationDate() { var confirmOld = $("#MaternityLeave_strSymptomDate").val(); var mySplitResult = confirmOld.split("-"); var confirm_date = mySplitResult[0].toString(); var confirm_month = parseFloat(mySplitResult[1].t...

mvc pass value in controller from script

Consider the following example i am firing the script with a list value using for loop table data. <a href='#' class="gridEdit" onclick="javascript:return DeleteServiceOut('@Model.EmployeeInformationList[i].GEmployeeGenInfoID.ToString()');"></a> the function to pass values to controller from Javascript code in MVC <script> function DeleteServiceOut(GEmployeeId) { window.location = "/PMS/Payroll/ServiceOutAdd/ServiceOutDelete/" + GEmployeeId; return false; } </script> in to the controller public ActionResult ServiceOutDelete(string id, ServiceOutModels model) { // id will contailn the value of parameter // AS you want return View("ServiceOutViewDetails", model); }

How to disable specific grid column in kendo ui Grid on inline editing

If you want to stop editing on specific Grid column in Kendo Ui grid like this Just use theDataAnnotations [ Editable ( false )] in your custom class for the grid i am just share my code for your help using System; using System . Collections . Generic; using System . ComponentModel . DataAnnotations; using System . Linq; using System . Web; namespace FEWO . ViewModel { public class Limitation { public long Id { get; set; } public int? LFDNR { get; set; } public Guid? ob_guid { get; set; } public DateTime? von { get; set; } public DateTime? bis { get; set; } public string einschrank { get; set; } public string wtagvon { get; set; } public string wtagbis { get; set; } public int numtagvon { get; set; } public int? numtagbis { get; set; } public int? nummonvon { get; set; } public int? nummonbis { get; set; } public int? numjahrvon { get; set; } public ...