Saturday, May 31, 2014

Sample code that change Background color On selection of color of own choice

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>HELLO WORLD:</title>
    <style type="text/css">
    h1
    {
        color:Blue;
        }
    h2
    {
        color:Red;
     
        }
    </style>

    <script type="text/javascript">

Code To display data in grid view from Database

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DALBlueWhale.Entities;
using System.Data;

public partial class ManageEmployees : System.Web.UI.Page
{
    Employee _employee;
    DataTable _table;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)

        {
            LoadData();
        }
    }

Gridview Property In ASP.NET

<%@ Page Title="" Language="C#" MasterPageFile="~/MainMaster.master" AutoEventWireup="true" CodeFile="ManageEmployees.aspx.cs" Inherits="ManageEmployees" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="box round first fullpage">

Database Entities Classes

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace DALBlueWhale.Entities
{
    public class Employee
    {
        DBWrapper _db;
        DataTable _table;

ASP.NET form to Add new Users

<%@ Page Title="BlueWhale | Add Employee" Language="C#" MasterPageFile="~/MainMaster.master" AutoEventWireup="true" CodeFile="AddEmployee.aspx.cs" Inherits="AddEmployee"%>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:TextBox ID ="txtState" runat ="server" Visible="false" ViewStateMode="Enabled"></asp:TextBox>
<asp:TextBox ID ="txtEmpId" runat ="server" Visible="false" ViewStateMode="Enabled"></asp:TextBox>
  <div class="box round first fullpage">

DBWrapper Class In C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace DALBlueWhale
{
    public class DBWrapper
    {
        ConnectionProvider _connProvider;
        SqlConnection _sqlConnection;
        SqlDataAdapter _da;

Code To Add New Users and Get Data fro drop down List

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DALBlueWhale.Entities;
using System.Data.SqlClient;
using DALBlueWhale;

public partial class AddEmployee : System.Web.UI.Page
{
    Employee _employee;
    DataTable _dtDepartment , _dtDsignation;
    DataSet _ds;
    DBWrapper _dbwrapper;

Configuration Setting For Form Authentication In web.config file In Asp.net

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <connectionStrings>

    <add name="ConnStr" connectionString="Data Source = inayat; Initial Catalog = HR; User ID=sa; Password=jan5562"/>
    <add name="xyz" connectionString="xyz"/>
  </connectionStrings>

LogIn Page Authentication In ASP.NET

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DALBlueWhale.Entities;
using System.Data.SqlClient;
using DALBlueWhale;
using System.Web.Security;