Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠
Adept Coder - Full Stack Developer

Ankit Kanojia ankitkanojia

🤠
Adept Coder - Full Stack Developer
View GitHub Profile
@ankitkanojia
ankitkanojia / Validation.js
Created Aug 7, 2020
To configure jquery validation
View Validation.js
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.2/jquery.validate.js"></script>
function InitializeValidation() {
$('.reuiredInput').attr("required", "required")
$("#verificationSelfFormControl").validate({
rules: {
".reuiredInput": {
required: true
}
@ankitkanojia
ankitkanojia / Common.cs
Created Jan 27, 2020
Custom filter with search and previous/next functionality in MVC C#
View Common.cs
//commoncode
public static CustomerModel GetData(int currentPage, string keyword)
{
int maxRows = 10;
var customerModel = new CustomerModel();
customerModel.Customers = new List<UserVm>();
var counter = 0;
var sqlQuery = string.Empty;
if(string.IsNullOrEmpty(keyword))
{
@ankitkanojia
ankitkanojia / Sample.html
Created Sep 17, 2019
Hight chart jquery plugin integration
View Sample.html
<html>
<body>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-3d.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<div id="container" style="height: 400px;width:500px"></></div>
@ankitkanojia
ankitkanojia / App.js
Created Sep 13, 2019
React routing using package 'react-router-dom'
View App.js
import React, {Component} from 'react';
import Header from './component/header';
import Main from './containers/main';
class App extends Component {
render() {
return (
<React.Fragment>
<Header />
<main className="container">
@ankitkanojia
ankitkanojia / App.jsx
Created Sep 3, 2019
API call in reactjs application using fetch request
View App.jsx
import React, {Component} from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
isLoading: true,
@ankitkanojia
ankitkanojia / App.jsx
Created Sep 3, 2019
API call in reactjs application using axios request
View App.jsx
import React, {Component} from 'react';
import logo from './logo.svg';
import './App.css';
//install axios package using 'npm i axios' command
const axios = require('axios');
class App extends Component {
constructor(props) {
@ankitkanojia
ankitkanojia / Default.aspx.cs
Created Sep 2, 2019
call web method using ajax call in webform c#
View Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
@ankitkanojia
ankitkanojia / Sample.cs
Last active Sep 2, 2019
Upload/Save media file using HttpPostedFileBase class in C# MVC
View Sample.cs
using ProjectNameSpace.Helpers;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
namespace ProjectNameSpace.Controllers
@ankitkanojia
ankitkanojia / script.js
Created Sep 2, 2019
Call ajax from any platform using jquery library
View script.js
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
function functionName(){
$.ajax({
type: "POST",
url: "URL",
data: '{parameterName: "' + parameterValue + '"',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
@ankitkanojia
ankitkanojia / Test.cs
Created Sep 2, 2019
Send mail using send grid in c#
View Test.cs
using YourProject.Helpers;
namespace YourProject.Controllers
{
public class HomeController : Controller
{
public void SendTestMail1620()
{
SendEmail.Send("EMAIL SUBJECT", "EMAIL TEMPLATE or CONTENT", "TO EMAIL");
You can’t perform that action at this time.