Validations In asp.net With Text focus Using Jquery

Step1:- Validations on jquery
$(document).ready(function () {
            $("#btnSave").click(function () {
                var firstName = $("#txtFirstName").val();
                var lastName = $("#txtLastName").val();
                var Email = $("#txtEmail").val();
                var password = $("#txtPassword").val();
                var confirmPassword = $("#txtConfirmPassword").val();
                var Gender = $("#ddlGender option:selected").text();
                if (firstName == "" && lastName == "" && Email == "" && password == "" &&        confirmPassword == "" && Gender == "Select Gender")
                {
                    $("#txtFirstName").css("border-color", "red");
                    $("#txtLastName").css("border-color", "red");
                    $("#txtEmail").css("border-color", "red");
                    $("#txtPassword").css("border-color", "red");
                    $("#txtConfirmPassword").css("border-color", "red");
                    $("#ddlGender").css("border-color", "red");
                    return false;
                }
            });
        });

Validations In ASP.NET Using Jquery

STEP1:- Jquery validations using button click
<script src="Scripts/jquery-3.1.1.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#btnSave").click(function () {
                var firstName = $("#txtFirstName").val();
                var lastName = $("#txtLastName").val();
                var Email = $("#txtEmail").val();
                var password = $("#txtPassword").val();
                var confirmPassword = $("#txtConfirmPassword").val();
                var Gender = $("#ddlGender option:selected").text();
                if (firstName == "") {
                    alert("First Name Required");
                }
                else if (lastName == "") {
                    alert("Last Name Required");
                }
                else if (Email == "") {
                    alert("Email Required");
                }
                else if (password == "") {
                    alert("Password Required");
                }
                else if (confirmPassword == "") {
                    alert("Confirm Password Required");
                }
                else if (Gender == "Select Gender") {
                    alert("Gender Required");
                }
            });
        });
    </script>

GridView Using StoredProcedure With Templatefield In ASP.NET

In this article i show you how to use gridview with templatefields  in asp.net
step1:-Create table
CREATE TABLE tblEmp
(
Id  int primary key identity,
FirstName   varchar(50),
LastName   varchar(50),
Designation   varchar(50),
Salary          int,
City   varchar(50),
)
Step2:-Insert some data in table

INSERT INTO tblEmp VALUES('SIVA','Garika','UiDeveloper',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Narayana','Garika','Developer',25000,'Hydarabad')
INSERT INTO tblEmp VALUES('Kiran','Thota','Developer',35000,'Hydarabad')
INSERT INTO tblEmp VALUES('Madhu','Thota','Developer',19000,'Hydarabad')
INSERT INTO tblEmp VALUES('Manasa','Javisetty','Testar',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Malavika','Dongari','Developer',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Mounika','Javisetty','Testar',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Anji','Dongari','Developer',25000,'Hydarabad')
INSERT INTO tblEmp VALUES('Aravind','Choodi','Developer',32000,'Hydarabad')
INSERT INTO tblEmp VALUES('Avinash','Choodi','Developer',26000,'Hydarabad')

GridView Using StoredProcedure With DataBoundControls In ASP.NET

In this article i show you how to use gridview with sqldatareader and databound controls  in asp.net
step1:-Create table
CREATE TABLE tblEmp
(
Id  int primary key identity,
FirstName   varchar(50),
LastName   varchar(50),
Designation   varchar(50),
Salary          int,
City   varchar(50),
)
Step2:-Insert some data in table

INSERT INTO tblEmp VALUES('SIVA','Garika','UiDeveloper',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Narayana','Garika','Developer',25000,'Hydarabad')
INSERT INTO tblEmp VALUES('Kiran','Thota','Developer',35000,'Hydarabad')
INSERT INTO tblEmp VALUES('Madhu','Thota','Developer',19000,'Hydarabad')
INSERT INTO tblEmp VALUES('Manasa','Javisetty','Testar',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Malavika','Dongari','Developer',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Mounika','Javisetty','Testar',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Anji','Dongari','Developer',25000,'Hydarabad')
INSERT INTO tblEmp VALUES('Aravind','Choodi','Developer',32000,'Hydarabad')
INSERT INTO tblEmp VALUES('Avinash','Choodi','Developer',26000,'Hydarabad')

GridView Using StoredProcedure With Dataset In ASP.NET

In this article i show you how to use sqldatareader in asp.net
step1:-Create table
CREATE TABLE tblEmp
(
Id  int primary key identity,
FirstName   varchar(50),
LastName   varchar(50),
Designation   varchar(50),
Salary          int,
City   varchar(50),
)
Step2:-Insert some data in table

INSERT INTO tblEmp VALUES('SIVA','Garika','UiDeveloper',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Narayana','Garika','Developer',25000,'Hydarabad')
INSERT INTO tblEmp VALUES('Kiran','Thota','Developer',35000,'Hydarabad')
INSERT INTO tblEmp VALUES('Madhu','Thota','Developer',19000,'Hydarabad')
INSERT INTO tblEmp VALUES('Manasa','Javisetty','Testar',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Malavika','Dongari','Developer',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Mounika','Javisetty','Testar',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Anji','Dongari','Developer',25000,'Hydarabad')
INSERT INTO tblEmp VALUES('Aravind','Choodi','Developer',32000,'Hydarabad')
INSERT INTO tblEmp VALUES('Avinash','Choodi','Developer',26000,'Hydarabad')

GridView Using StoredProcedure With Sqldatareader In ASP.NET

In this article i show you how to use sqldatareader in asp.net
step1:-Create table
CREATE TABLE tblEmp
(
Id  int primary key identity,
FirstName   varchar(50),
LastName   varchar(50),
Designation   varchar(50),
Salary          int,
City   varchar(50),
)
Step2:-Insert some data in table

INSERT INTO tblEmp VALUES('SIVA','Garika','UiDeveloper',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Narayana','Garika','Developer',25000,'Hydarabad')
INSERT INTO tblEmp VALUES('Kiran','Thota','Developer',35000,'Hydarabad')
INSERT INTO tblEmp VALUES('Madhu','Thota','Developer',19000,'Hydarabad')
INSERT INTO tblEmp VALUES('Manasa','Javisetty','Testar',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Malavika','Dongari','Developer',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Mounika','Javisetty','Testar',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Anji','Dongari','Developer',25000,'Hydarabad')
INSERT INTO tblEmp VALUES('Aravind','Choodi','Developer',32000,'Hydarabad')
INSERT INTO tblEmp VALUES('Avinash','Choodi','Developer',26000,'Hydarabad')

How to restrict textbox values in angularJS

In this article i show you how to get textbox value in angulaJS. First we need to add angularJS reference
in html page
Step1:- add angularJS reference in html page
    <script src="Scripts/angular.js"></script>
    <script src="Scripts/Script1.js"></script>
Script1.js is the javascript file for declaring module and controller

/// <reference path="angular.min.js" />
var app = angular.module("myapp",[])
    .controller("mycontroller", function ($scope)
    {
})
add reference to the javascriptfile
step2:-Add html page.In angularJS we have two directives ng-mimilenth ang ng-maxlenth for restricting textbox values.We are using expressions for getting textbox value.Expressions are declared by using bracess
    <div ng-app="myapp">
        <div ng-controller="mycontroller">
            <input type="text" ng-model="name" ng-maxlength="12" ng-minlength="5"  />
            <br />
            <br />
            {{name}}
        </div>
    </div>

How to get textbox value in angularJS

In this article i show you how to get textbox value in angulaJS. First we need to add angularJS reference
in html page
Step1:- add angularJS reference in html page
    <script src="Scripts/angular.js"></script>
    <script src="Scripts/Script1.js"></script>
Script1.js is the javascript file for declaring module and controller

/// <reference path="angular.min.js" />
var app = angular.module("myapp",[])
    .controller("mycontroller", function ($scope)
    {
})
add reference to the javascriptfile
step2:-Add html page.We are using expressions for getting textbox value.Expressions are declared by using bracess
    <div ng-app="myapp">
        <div ng-controller="mycontroller">
            <input type="text" ng-model="name"  />
            <br />
            <br />
            {{name}}
        </div>
    </div>

How to define array of list items to the dropdownlist in asp.net

     We can define array of list items to the dropdownlist in code behind
   protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                ListItem[] li = new ListItem[4];
                {
                new ListItem("AP","1");
                new ListItem("UP","2");
                new ListItem("MP","3");
                new ListItem("TS","4");
                }
                DropDownList1.Items.AddRange(li);
                //INSERT AN ITEM AS LISTITEM AT ZERO INDEX
                DropDownList1.Items.Insert(0, new ListItem("Select State", "0"));

How to declare dropdownlist different ways in asp.net

In this article i show you how to declare dropdownlist different ways in asp.net
First we can declare in source code
1st way:-
        <asp:DropDownList ID="DropDownList1" runat="server">
            <asp:ListItem Text="Select State" Value="-1"></asp:ListItem>
            <asp:ListItem Text="AP" Value="1"></asp:ListItem>
            <asp:ListItem Text="UP" Value="2"></asp:ListItem>
            <asp:ListItem Text="TS" Value="3"></asp:ListItem>
            <asp:ListItem Text="MP" Value="4"></asp:ListItem>
            <asp:ListItem Text="Tamilnadu" Value="5"></asp:ListItem>          
        </asp:DropDownList>
2nd way:-
        <asp:DropDownList ID="DropDownList1" runat="server">
            <asp:ListItem  Value="-1">Select State</asp:ListItem>
            <asp:ListItem  Value="1">AP</asp:ListItem>
            <asp:ListItem  Value="2">UP</asp:ListItem>
            <asp:ListItem  Value="3">TS</asp:ListItem>
            <asp:ListItem  Value="4">MP</asp:ListItem>
            <asp:ListItem  Value="5">Tamilnadu</asp:ListItem>          
        </asp:DropDownList>