Posts

Showing posts from 2017

Remove form validation rule on click event of Specific Button

Remove form validation rule on click event of Specific Button Apply or Remove rules on the Button when click event occurs. $( '#btnSubmit’).on(' click ', function(){     $( '[name="Postcode"]' ).rules ( 'add' , {         required: true ,         email: true     });     $( '#County).rules(' remove ');            $( '#personal-details-form' ). valid (); // Trigger the validation & do NOT submit        }); And also, when you use other button, while using Click event, remove rules applied on  #btnSubmit’ click . Just in your case if you want to Invalidate  Surname  if you have set using other buttons, use  $('[name="Surname"]').rules('remove'); $('[name="FirstName"]').rules('remove'); Example: $(document).ready( function (...

Get the Radio Button text in JQuery from the particular div

Image
Get the Radio Button text in JQuery from the particular div

What is the output of the following C Code?

What is the output of the following C Code? #include <stdio.h> void main() {                 int k=5;         int *p=&k;         int **m=&p;                  printf("%d%d%d\n",k,*p,**m);          } A) 5 5 5 B) 5 5 junk C) 5 junk junk D) Compile time error

Paging using LINQ Skip and Take

Paging using LINQ Skip and Take Suppose you have a data in result object IEnumerable < RTRDocumentSearchResultViewModel > result; Pass the Parameter of PageIndex and PageSize Suppose, PageIndex=1, PageSize=3   First, count the number data in result count = result.Count(); Then, after int skipCount = (model.PageIndex - 1) * model.PageSize; var resetSet = result.AsQueryable(); resetSet = skipCount == 0 ? resetSet.Take(model.PageSize) : resetSet.Skip(skipCount).Take(model.PageSize); and finally return the new resul AsEnumerable() collection resetSet.AsEnumerable();

How to get CKEditor content in- jQuery?

How to get CKEditor content in- jQuery? You can use  this code         var editor = CKEDITOR.instances.Body;   //Body is the Id of the CKEditor var varMailBody = editor.getData(); alert(varMailBody); Using this we can get CKEditor Content in Jquery

Bind Dropdown List Between Two Dates in DD MMM Format

Bind Dropdown List Between Two Dates in DD MMM  Format var Startdate = System. DateTime .Now;  var lastDate = Startdate.AddDays(30); List Collection For the Store List of Dates List < SelectListItem > listDate = new List < SelectListItem >(); For Loop For the Add Dates in SelectListItem with Suffix for ( DateTime date = Startdate; date <= lastDate; date = date.AddDays(1)) {             int day1 = date.Day;             int month1 = date.Month;             string dtDate = GetDaySuffix(day1) + " " + GetMonthString(month1);      listDate.Add( new SelectListItem { Value = dtDate, Text = dtDate });                 } model.DateList = listDate; Method to Ge...

Unable to create a constant value of type 'System.Object'. Only primitive types or enumeration types are supported in this context."

Solution of the Error: Unable to create a constant value of type 'System.Object'. Only primitive types or enumeration types are supported in this context." If in LINQ query both variable Data Type is same then no any error throw LINQ Query. But if the data type of the variable is different than LINQ Query throws error. For example, if the One Variable Data Type is Int another is Nullable Int then throws the Error. Now, for resolving the Error we can use the Following alternatives   1)      m=>m.id==id   2)      m=>m.id.value.equals(id) One of these works fine for the query

Repository and Unit of Work Patterns in an ASP.NET MVC Application

Image
Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application The repository and unit of work patterns are intended to create an abstraction layer between the data access layer and the business logic layer of an application. Implementing these patterns can help insulate your application from changes in the data store and can facilitate automated unit testing or test-driven development (TDD). In this tutorial you'll implement a repository class for each entity type. For the  Employee  entity type you'll create a repository interface and a repository class. When you instantiate the repository in your controller, you'll use the interface so that the controller will accept a reference to any object that implements the repository interface. When the controller runs under a web server, it receives a repository that works with the Entity Framework . When the controller runs under a unit test class, it receives a repository that works with data stored ...