Saturday 28 October 2017

Anonymous method in C# Complete Guide from basic

example -1

 class Program
    {
        public delegate void Print(int value);
        static void Main(string[] args)
        {
            Print print = delegate(int val)
            {
                Console.WriteLine("Inside Anonymous method. Value: {0}", val);
            };

            print(100);
            print(2000);

            Console.ReadLine();
        }




    }

example -2

 class Program
    {
        public delegate void Print(int value);
        static void Main(string[] args)
        {
            int i = 10;

            Print prnt = delegate(int val)
            {
               // val += i;
                val = val + i;
                Console.WriteLine("Anonymous method: {0}", val);
            };

            prnt(100);

            Console.ReadLine();
        }
    }

example -3


  class Program
    {
        public delegate void Print(int value);
   
        static void Main(string[] args)
        {
            PrintHelperMethod(delegate(int val) 
            {
                Console.WriteLine("Anonymous method: {0}", val); 
            }, 100);

            Console.ReadLine();


        }

        public static void PrintHelperMethod(Print printDel, int val)
        {
            val += 10;
            printDel(val);
        }
    }

Friday 27 October 2017

From Validation in JavaScript with html and Css Complete Tutorial From Basic

Html code:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Form Validation</title>

<link href="css/style.css" rel="stylesheet" type="text/css"/>
</head>

<body>
<div id="wrapper"> 




<div id="formbox">

<table> 


<tr>  <td style="width:30px">Email </td>   <td> <input type="text" id="email" onChange="checkemail()" style="border-radius:20px 20px 20px 20px;height:35px;width:200px"/> </td>  <td> <span id="emailerror"> </span>  </td>  </tr>


<tr>  <td>Password </td>   <td> <input type="password"  id="pwd" onChange="checkPASSWORDLENGTH()" style="border-radius:20px 20px 20px 20px;height:35px;width:200px"/> </td>  <td> <span id="pwderror"> </span>  </td>  </tr>



<tr>  <td>Confirm Password </td>   <td> <input type="password" id="cpwd" onChange="confrimpassword()"  style="border-radius:20px 20px 20px 20px;height:35px;width:200px"/> </td>  <td> <span id="cpwderror"> </span>  </td>  </tr>

<tr>   
 <td>


 </td> 
 <td>
<button> Submit!</button>

 </td> 
 
 
  </tr>



</table>


 </div>






</div>

<script src="js/js.js"> </script>


</body>
</html>

css code:

@charset "utf-8";
/* CSS Document */
body
{ margin:0 auto;
padding:0px;

}

#wrapper
{ width:100%;
height:1000px;
background-image:url(../img/login.jpg);
background-size:100% 1000px;

}
#formbox
{ width:500px;
height:300px;
background-color:rgba(243, 242, 242,0.4); 
position:absolute;
 margin-left:300px;
 margin-top:300px; 



}
td
{ padding:15px;
}

Js code:

// JavaScript Document

function checkemail()
{
var c=document.getElementById("email").value;
var pos=c.search("@");
if(pos==-1)
{
document.getElementById("emailerror").innerHTML="Invalid Email Id";
document.getElementById("emailerror").style.color="red";
}
else
{
var domainname=c.substring(pos+1); 

var d= domainname.toLowerCase();

if(d!=="yahoo.com")
{
document.getElementById("emailerror").innerHTML="use correct domain name like yahoo.com";
document.getElementById("emailerror").style.color="red";

}
else
{
document.getElementById("emailerror").innerHTML="valid Email Id";
document.getElementById("emailerror").style.color="green";
}


}



}







function checkPASSWORDLENGTH()
{
var c=document.getElementById("pwd").value;
var l=c.length;
if(l<8 || l>15)
{
document.getElementById("pwderror").innerHTML="Password should contain atleast 8 characters!";
document.getElementById("pwderror").style.color="red";
}

else
{
document.getElementById("pwderror").innerHTML="valid Password ";
document.getElementById("pwderror").style.color="green";
}
}







function confrimpassword()
{

var pwd=document.getElementById("pwd").value;
var cpwd=document.getElementById("cpwd").value;

if(pwd!==cpwd)
{
document.getElementById("cpwderror").innerHTML="Password Mismatch";
document.getElementById("cpwderror").style.color="red";
}
else
{
document.getElementById("cpwderror").innerHTML="Password match";
document.getElementById("cpwderror").style.color="green";

}


}


image and jumbotron class in bootstrap





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>grid in bs</title>

<link type="text/css" rel="stylesheet" href="css/bootstrap.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap.min.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap-theme.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap-theme.min.css"/>



<style>



body

{ background-color:#000;

 

}



#SIDE a:hover

{ background-color:#09F;

color:#fff;

font-family:"Courier New", Courier, monospace;

font-size:26px;



}



</style>



</head>



<body>



<div class="container" style="height:1000px; background-color:#069">



<div class="row" style="height:200px; background-color:#096;background-image:url(img/1.jpg); background-size:100% 1000px">



<div class="col-sm-4" style="height:200px; ">



<img src="img/logo (1).png" style="width:80%;height:200px"/>

 </div>



<div class="col-sm-4" style="height:200px; "> </div>



<div class="col-sm-4" style="height:200px; ">



</div>





</div>



<!-- HEad section end..............................................  -->

<div class="row" style="height:50px; background-color:#036">









</div>





<DIV class="row" style=" height:1000px; background-color:#CCC">



<div ID="SIDE" style="height:1000px;background-image:url(img/1.jpg); background-size:100% 1000px" class="col-sm-2">



<h3>ASIDE BAR </h3>







<nav>



<ul class="nav  nav-pills  nav-stacked">



<li class="active"> <a href="#" >Home </a> </li>





<li> <a href="#">About Us </a> </li>





<li> <a href="#">Gallery </a> </li>





<li> <a href="#">Contact Us </a> </li>





<li> <a href="#">Admission </a> </li>





<li> <a href="#">Home </a> </li>





<li> <a href="#">About Us </a> </li>





<li> <a href="#">Gallery </a> </li>





<li> <a href="#">Contact Us </a> </li>





<li> <a href="#">Admission </a> </li>











</ul>



</nav>











</div>



<div style="background-color:white;height:1000px;background-image:url(img/2.jpg); background-size:100% 1000px" class="col-sm-8">





<div style="width:100%; background-color:rgba(82, 99, 158,0.4)">

<div class="jumbotron" >



<h1>Bootstrap Tutorial </h1>



<p>Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web. </p>



</div>



</div>



<table style="margin-left:90px">



<tr>

<td>

<img src="img/slide1.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>



<td>

<img src="img/slide2.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>

 

 

 <td>

<img src="img/slide3.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>

 

 



 </tr>



 <tr>

<td>

<img src="img/slide2.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>



<td>

<img src="img/slide3.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>

 

 

 <td>

<img src="img/slide1.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>

 

 



 </tr>





 <tr>

<td>

<img src="img/slide1.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>



<td>

<img src="img/slide2.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>

 

 

 <td>

<img src="img/slide3.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>

 

 



 </tr>













</table>







</div>





<div style="background-color:#C03;height:1000px; background-image:url(img/1.jpg); background-size:100% 1000px" class="col-sm-2"> </div>











</DIV>



























</div>



<!--  CONTAINER end..............................................  -->



























<script src="js/bootstrap.js"> </script>

<script src="js/bootstrap.min.js"> </script>

<script src="js/jquery.js"> </script>

<script src="js/jquery-migrate-1.4.1.min.js"> </script>





</body>



</html>

Thursday 26 October 2017

Complete Guide of store procedure with return and output parameters in ...





create database employee



use employee



create table tblemployee

(

id int primary key identity,

name nvarchar(20),

gender nvarchar(20),

dept_id int

)





insert into tblemployee values('salman','male',201)

insert into tblemployee values('raza','male',241)

insert into tblemployee values('ali','male',241)

insert into tblemployee values('sana','female',601)

insert into tblemployee values('sami','male',101)

insert into tblemployee values('test','female',201)



select * from tblemployee





create proc insert_tblemp

(

@name nvarchar(20),

@gender nvarchar(20),

@dept_id int,

@NewId int output

)

as



begin



insert into tblemployee values(@name,@gender,@dept_id)





 Select @NewId = SCOPE_IDENTITY()





end







declare @id int

execute insert_tblemp 'umar','male',231,@id out

print @id







 ---------------------------------------------------------



 Create Procedure spGetTotalCountOfEmployees1

@TotalCount int output

as

Begin

 Select @TotalCount = COUNT(ID) from tblEmployee

End





Declare @TotalEmployees int

Execute spGetTotalCountOfEmployees1 @TotalEmployees Output

Select @TotalEmployees



------------------------------------------------------------



Create Procedure spGetTotalCountOfEmployees2

as

Begin

 return (Select COUNT(ID) from tblemployee)

End



Declare @TotalEmployees int

Execute @TotalEmployees = spGetTotalCountOfEmployees2

Select @TotalEmployees

----------------------------------------------------------





select * from tblemployee























 Create Procedure spGetNameById0

@Id int,

@Name nvarchar(20) Output

as

Begin

 Select @Name = Name from tblemployee Where Id = @Id

End





Declare @EmployeeName nvarchar(20)

Execute spGetNameById0 1, @EmployeeName out

Print 'Name of the Employee = ' + @EmployeeName







Create Procedure spGetNameById01

@Id int

as

Begin

 Return (Select Name from tblEmployee Where Id = @Id )

End







Declare @EmployeeName nvarchar(20)

Execute @EmployeeName = spGetNameById01 1

Print 'Name of the Employee = ' + @EmployeeName












Wednesday 25 October 2017

create animation using js











html code:



<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>space</title>

<style>

body

{ margin:0 auto;

padding:0px;

}



#wrapper

{

height:900px;

background-image:url(img/maxresdefault.jpg);

background-size:100% 900px;

 

}



</style>



</head>



<body>



<div id="wrapper">



<img src="img/1.png"  style="margin-left:300px; margin-top:150px;" id="st" onMouseOver="runcomplete()"/>





 </div>















<script src="js/js.js"> </script>





</body>

</html>



javascript code:
// JavaScript Document
A=new Array("img/2.png","img/3.png","img/1.png");

function a()
{ document.getElementById('st').src=A[0];
}
function b()
{ document.getElementById('st').src=A[1];
}
function c()
document.getElementById('st').src=A[2];
}

function runcomplete()
{
setTimeout(a,500);
setTimeout(b,1000);
setTimeout(c,1500);
setTimeout(a,2000);
setTimeout(b,2500);
setTimeout(c,3000);

}









Delegates in c#





using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;



namespace deletegate_salman

{

    class Program

    {

        public delegate void print(int num);

        static void Main(string[] args)

        {

            print p = printsalary;

            p(50000);

            p(450000);



            p = printeMPLOYEEID;

            p(50000);

            p(450000);





            Console.ReadLine();

        }



        public static void printsalary(int s)

        {

            Console.WriteLine("salary is :"+s);

        }





        public static void printeMPLOYEEID(int s)

        {

            Console.WriteLine("EmploeeId is :" + s);

        }











    }

}


Monday 23 October 2017

How to make tables and images responsive (IMAGE AND TALBES IN BOOTSTRAP)



<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>grid in bs</title>

<link type="text/css" rel="stylesheet" href="css/bootstrap.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap.min.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap-theme.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap-theme.min.css"/>

</head>



<body>



<div class="container" style="height:1000px; background-color:#069">



<div class="row" style="height:200px; background-color:#096">



<div class="col-sm-4" style="height:200px; background-color:red">

<img src="img/logo.png" style="width:200px; height:200px;" class="img-responsive img-thumbnail"/>



 </div>



<div class="col-sm-4" style="height:200px; background-color:green"> </div>



<div class="col-sm-4" style="height:200px; background-color:yellow">

<img src="img/changeimg.jpg" style="width:200px; height:200px;" class="img-responsive  img-rounded"/>

</div>





</div>



<!-- HEad section end..............................................  -->

<div class="row" style="height:50px; background-color:#096">



</div>





<DIV class="row" style=" height:500px; background-color:#CCC">



<div style="background-color:#03C;height:500px" class="col-sm-3"> </div>



<div style="background-color:white;height:500px" class="col-sm-6">



<h1 >Bootstrap Tutorials <small> Tables </small> </h1>



<table class="table table-striped table-bordered table-hover table-responsive">



<tr> <td><b> Id</b> </td>  <td><b> Name</b> </td> <td><b> Email </td> </tr>





<tr> <td> 1</td>  <td> Salmanmasood</td> <td>theideassolution@gmail.com</td> </tr>





<tr> <td> 2</td>  <td> Ali</td> <td>Alisolution@gmail.com</td> </tr>







<tr> <td> 3</td>  <td> Umar</td> <td>Umardeassolution@gmail.com</td> </tr>











</table>







</div>





<div style="background-color:#C03;height:500px" class="col-sm-3"> </div>











</DIV>



























</div>



<!-->  CONTAINER end..............................................  -->



























<script src="js/bootstrap.js"> </script>

<script src="js/bootstrap.min.js"> </script>

<script src="js/jquery.js"> </script>

<script src="js/jquery-migrate-1.4.1.min.js"> </script>





</body>



</html>


How to break page sections without css (grids in bootstrap)

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>grid in bs</title>
<link type="text/css" rel="stylesheet" href="css/bootstrap.css"/>
<link type="text/css" rel="stylesheet" href="css/bootstrap.min.css"/>
<link type="text/css" rel="stylesheet" href="css/bootstrap-theme.css"/>
<link type="text/css" rel="stylesheet" href="css/bootstrap-theme.min.css"/>
</head>

<body>

<div class="container" style="height:1000px; background-color:#069">

<div class="row" style="height:200px; background-color:#096">

<div class="col-sm-4" style="height:200px; background-color:red">


 </div>

<div class="col-sm-4" style="height:200px; background-color:green"> </div>

<div class="col-sm-4" style="height:200px; background-color:yellow">

</div>


</div>

<!-- HEad section end..............................................  -->
<div class="row" style="height:50px; background-color:#096">

</div>


<DIV class="row" style=" height:500px; background-color:#CCC">

<div style="background-color:#03C;height:500px" class="col-sm-3"> </div>

<div style="background-color:white;height:500px" class="col-sm-6">





</div>


<div style="background-color:#C03;height:500px" class="col-sm-3"> </div>





</DIV>













</div>

<!-->  CONTAINER end..............................................  -->













<script src="js/bootstrap.js"> </script>
<script src="js/bootstrap.min.js"> </script>
<script src="js/jquery.js"> </script>
<script src="js/jquery-migrate-1.4.1.min.js"> </script>


</body>

</html>

Friday 20 October 2017

How to Make FaceBook login Page using Bootstrap (part 2/2)




<!doctype html>

<html>

<head>



<title>Facebook.com</title>

<meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="description" content="">

    <meta name="author" content="">



<link type="text/css" rel="stylesheet" href="css/bootstrap.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap.min.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap-grid.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap-reboot.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap-reboot.min.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap-grid.min.css"/>





<link rel="shortcut icon" href="img/icon.png">





<style>



td{

padding:8px;

}



</style>





</head>



<body>









<div class="row" style="background-color:#000;height:100px;">



<div class="col-md-6" style="height:100px; background-color:rgb(47,69,117)">



<img src="img/logo.png" style="width:200px; height:60px;margin-left:100px; margin-top:20px;"/>



 </div>



<div class="col-md-6" style="height:100px;  background-color:rgb(47,69,117">



<div class="row">

<div class="col-4">



<p style="color:white;">Email</p>

<input type="text"/><br>

<span style="color:white;"><input type="checkbox"/>Keep Me log In </span>



</div>







<div class="col-4" style="margin-left:20px;">



<p style="color:white;">Password</p>

<input type="password"/><br>

<span style="color:white;">Forgotten Password? </span>





</div>





</div>



 </div>

















</div>







<div class="row" style="background-color:blue;height:900px;">



<div class="col-md-7" style="background-color:rgb(226,230,241);height:900px">



<img src="img/facebook-connecting-people.jpg" style="width:100%; height:400px; margin-top:50px"/>





 </div>



<div class="col-md-5" style="height:900px;background-color:rgb(227,229,241)">



<h1> Create an Account</h1>

<br>

<h3> It's Free and always will be</h3>

<form style="margin:0 auto;width:90%;"> 



<table>



<tr>



<td style="width:50%"> <input type="text" placeholder="First Name" class="form-control"/ ></td>

<td style="width:50%"> <input type="text" placeholder="last Name" class="form-control"/ ></td>



 </tr>





 <tr> <td colspan="2"> <input type="text" placeholder="Email" class="form-control"/ ></td>

</tr>





 <tr> <td colspan="2"> <input type="text" placeholder="Re-Enter Email" class="form-control"/ ></td>

</tr>



 <tr> <td colspan="2"> <input type="password" placeholder="Password" class="form-control"/ ></td>

</tr>



 <tr> <td > <input type="password" placeholder="yy-mm-dd" class="form-control"/ ></td>

</tr>



<tr>

<td>

<span style="font-size:24px;color:#06F"> <input type="radio" >Male </span>



<span style="font-size:24px;color:#06F"><input type="radio">Female</span>

</td>

 </tr>





 <tr> <td><p>To make your document look professionally produced, Word provides header, footer, cover  </p> </td> </tr>





 <tr> <td> <button class="btn btn-lg btn-success" > Create An Account</button> </td> </tr>



</table>







</form>





</div>







</div>















































<script src="js/bootstrap.js">



</script>



<script src="js/bootstrap.min.js">



</script>





</body>



</html>

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...