Skip to content

Instantly share code, notes, and snippets.

View ankitkanojia's full-sized avatar
🤠
Adept Coder - Full Stack Developer

Ankit Kanojia ankitkanojia

🤠
Adept Coder - Full Stack Developer
View GitHub Profile
@ankitkanojia
ankitkanojia / Validation.js
Created August 7, 2020 15:46
To configure jquery validation
<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 January 27, 2020 17:14
Custom filter with search and previous/next functionality in MVC C#
//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 September 17, 2019 06:04
Hight chart jquery plugin integration
<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 September 13, 2019 10:43
React routing using package 'react-router-dom'
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 September 3, 2019 03:47
API call in reactjs application using fetch request
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 September 3, 2019 03:46
API call in reactjs application using axios request
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 September 2, 2019 08:04
call web method using ajax call in webform c#
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 January 2, 2024 23:20
Upload/Save media file using HttpPostedFileBase class in C# MVC
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 September 2, 2019 07:24
Call ajax from any platform using jquery library
<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 September 2, 2019 05:56
Send mail using send grid in c#
using YourProject.Helpers;
namespace YourProject.Controllers
{
public class HomeController : Controller
{
public void SendTestMail1620()
{
SendEmail.Send("EMAIL SUBJECT", "EMAIL TEMPLATE or CONTENT", "TO EMAIL");