This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Me And My Respected Teacher Mr Kamal Sheel Mishra

Mr. K.S. Mishra is HOD of Computer Science from SMS Varanasi where I have completed my MCA

Me And My Respected Teacher Mr Udayan Maiti

Mr. Udayan Maiti is a senior .Net Expert and has guided many professionals of multi national Companies(MNC)

Me And My Best Friend Mr Ravinder Goel

Mr. Ravinder Goel is a senior Software Engineer and now he is working Wipro Technology

Friday, 6 July 2012

Create Menu In Asp.Net with help Css...................

Creating  Menu in Asp.Net with help CSS.....................




Take  Default.aspx  in Asp.Net and create menu ...........

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>


 <!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 runat="server">

        <title> Cetpa Info Tech Pvt Lmd </title>


        <%--styleSheet.css  impliment in this page --%>



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

</head>

<body>

       <form id="form1" runat="server">


       <div>

          

       </div>


       <div class="d1">

       <marquee behavior="alternate">Cetpa Info Tech Pvt Lmd</marquee>

       </div>


    <div>

    <ul>

    <li>Home</li>

    <li>About Us</li>

    <li>Contact Us</li>

    <li>Servies

    <ul>

    <li><a href="Defaultramesh.aspx" >Training</a></li>

    <li>Development</li>

    </ul>

     </li>

    <li>Gallary</li>

     </ul>

   </div>

   <div>



   <div class="d2">

           

   <asp:Login ID="Login1" runat="server" BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#333333">

<InstructionTextStyle Font-Italic="True" ForeColor="Black" />

<LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775" />

                   <TextBoxStyle Font-Size="0.8em" />

                   <TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="0.9em"

                ForeColor="White" />

</asp:Login>

   

       </div>

      <div class="d3">

   

       </div>

   

       </div>

      </form>

</body>

</html>





/* Frist take StyleSheet.css for difine ....................................*/


body

{

   /*background-color:#CBE56F;*/

}

.d1

{

    width:auto;

    height:30px;

    color:Red;

   background-color:#1784D4;

   text-align:center;

   letter-spacing:1px;

 font-size:x-large;

 font-style:italic;

   padding-top:15px;

   font-weight:bold;

  padding-bottom:10px;

  

}

.d1:hover

{

    color:Green;

   background-color:Yellow;

   text-align:center;

   letter-spacing:15px;

}

h1

{

    color:Red;

   background-color:Aqua;

   text-align:center;

   letter-spacing:1px;

}

h1:hover

{

    color:Green;

   background-color:Yellow;

   text-align:center;

   letter-spacing:5px;

}

ul

{

    width:100%;

    list-style:none;

    margin:0px;

    padding:0px;

   

   

   

}

ul li

{

    width:19.75%;

    float:left;

    font-size:larger;

    font-style:italic;

    text-align:center;

    font-weight:bold;

    color:blue;

    margin:0px;

    padding-top:5px;

    height:30px;

    display:inline;

    text-decoration:none;

    background-color:Red;

    border:5px,Solid white,black;

    border-color: #000;

    border-width: 3px 3px 3px 0;

   border-style: solid;


   

   /*padding:2px 2px 2px 2px;

    margin-left:15px;

    margin:10px 23px 34px 67px;

    padding:10px 10px 10px 10px;*/

}

ul li:hover

{

 background-color:Black;

 color:Green;

 border:2px ,soli white;



   

}

   

   

   

ul li ul

{

    display:none;

}


ul li:hover ul

{

    display:block;

}



ul li ul li

{

    width:100%;

    text-align:center;

    top:10px;

    position:relative;

}


ul li ul li:hover

{

    background-color:Black;

    width:100%;

    text-align:center;

    top:10px;

    position:relative;

}


.d2

{

    width:22%;

    float:left;

    height:150px;

   

   

}

.d3

{ 
width:78%;

height:5%;



}

Connectivity ADO.NET with Connected Mode (for begainer Student...)


This code for Connectivity with DataBase (Ado.NET with Sql Server ) in Connected Mode.........


//create  table  Customer  in Database which name is Test  ........................

use test
Create table Customer(SrNo int primary key,FirstName nvarchar(50),LastName nvarchar(50),Dob DateTime)

select * from Customer





using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//using this namespace  for Connectivity  with ADO.NET........................
using System.Data.SqlClient;

namespace ConnectivityWithSql
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Code For Save data in DataBase .......................
private void btnsave_Click(object sender, EventArgs e)
{
try
{
//create  object  of Connection Class..................
SqlConnection con = new SqlConnection();
//Set Connection String property of Connection object..................
con.ConnectionString = @"Data Source=KUSH-PC\KUSH;Initial Catalog=test;Integrated Security=True";
//Open Connection..................
con.Open();
//Create object of Command Class................
SqlCommand cmd = new SqlCommand();
//set Connection Property  of  Command object.............
cmd.Connection = con;
//Set Command type of command object
//1.StoredProcedure
//2.TableDirect
//3.Text   (By Default)
cmd.CommandType = CommandType.Text;
//Set Command text Property of command object.........
cmd.CommandText = "insert into Customer(SrNo,FirstName,LastName,Dob) values(" + Convert.ToInt32(txtcustomerid.Text) + ",'" + txtfname.Text + "','" + txtlname.Text + "','" +Convert.ToDateTime(txtdob.Text) + "')";

//Execute command by calling following method................
   1.ExecuteNonQuery()
       It  query using for  insert,delete,update command...........
 2.ExecuteScalar()
     It  query return a single value and insert all record...................(using select,insert command)
//   3.ExecuteReader()
//      It  query return one or more than one record....................................

cmd.ExecuteNonQuery();


MessageBox.Show("Data Saved");
TextBoxClear();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}




}
//Code For Serach data From DataBase with SrNo
private void btnsearch_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=KUSH-PC\\KUSH;Initial Catalog=test;Integrated Security=True";
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from Customer where SrNo='" + Convert.ToInt32(txtcustomerid.Text) + "'";
cmd.Connection = con;
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{

txtfname.Text = dr["FirstName"].ToString();
txtlname.Text = dr[2].ToString();
txtdob.Text = dr.GetDateTime(3).ToShortDateString();
}
else
MessageBox.Show("Record not found", "No record", MessageBoxButtons.OK, MessageBoxIcon.Information);
con.Close();


}
//Code For Delete data From DataBase with SrNo
private void btndelete_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=KUSH-PC\\KUSH;Initial Catalog=test;Integrated Security=True";
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "Delete from Customer where SrNo='" + Convert.ToInt32(txtcustomerid.Text) + "'";
cmd.Connection = con;
int i=cmd.ExecuteNonQuery();
if (i > 0)
{
MessageBox.Show("Data delete Successfully for SrNo" + txtcustomerid.Text);
TextBoxClear();
}
else
{
MessageBox.Show("Record not found", "No record", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
con.Close();
}
//Code For Update data From DataBase with SrNo
private void btnupdate_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=KUSH-PC\\KUSH;Initial Catalog=test;Integrated Security=True";
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "Update Customer set  FirstName='" + txtfname.Text + "',LastName='" + txtlname.Text + "',Dob='" +Convert.ToDateTime(txtdob.Text) + "' where SrNo='"+Convert.ToInt32(txtcustomerid.Text)+"'";
cmd.Connection = con;
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
MessageBox.Show("Data updated Successfully for SrNo" + txtcustomerid.Text);
TextBoxClear();
}
else
{
MessageBox.Show("Record not found", "No record", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
con.Close();
}
//Code For Searching First  Row From DataBase
private void btnfirst_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=KUSH-PC\\KUSH;Initial Catalog=test;Integrated Security=True";
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from Customer";
cmd.Connection = con;
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
txtcustomerid.Text = dr.GetInt32(0).ToString();
txtfname.Text = dr["FirstName"].ToString();
txtlname.Text = dr.GetString(2);
txtdob.Text = dr.GetDateTime(3).ToShortDateString();
}
else
{
MessageBox.Show("Record not found", "No record", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
con.Close();
}
//Code For Searching Last  Row From DataBase
private void btnlast_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=KUSH-PC\\KUSH;Initial Catalog=test;Integrated Security=True";
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from Customer";
cmd.Connection = con;
SqlDataReader dr = cmd.ExecuteReader();
while(dr.Read())
{

txtcustomerid.Text = dr.GetInt32(0).ToString();
txtfname.Text = dr["FirstName"].ToString();
txtlname.Text = dr.GetString(2);
txtdob.Text = dr.GetDateTime(3).ToShortDateString();
}
con.Close();
}
//Code For Searching Previouse  Row From DataBase
private void btnprevious_Click(object sender, EventArgs e)
{
string a = txtcustomerid.Text;
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=KUSH-PC\\KUSH;Initial Catalog=test;Integrated Security=True";
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from Customer";
cmd.Connection = con;
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
if (a == dr[0].ToString())
{
return;
}
txtcustomerid.Text = dr.GetInt32(0).ToString();
txtfname.Text = dr["FirstName"].ToString();
txtlname.Text = dr.GetString(2);
txtdob.Text = dr.GetDateTime(3).ToShortDateString();
}
con.Close();
}
//Code For Searching Next  Row From DataBase
private void btnnext_Click(object sender, EventArgs e)
{
string a = (txtcustomerid.Text);
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=KUSH-PC\\KUSH;Initial Catalog=test;Integrated Security=True";
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from Customer";
cmd.Connection = con;
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
if (a == dr[0].ToString())
{
dr.Read();
txtcustomerid.Text = dr.GetInt32(0).ToString();
txtfname.Text = dr["FirstName"].ToString();
txtlname.Text = dr.GetString(2);
txtdob.Text = dr.GetDateTime(3).ToShortDateString();
return;
}
}
con.Close();

}
//Blank All TextBox
private void TextBoxClear()
{
// different method for blank  TextBox Text.......................

txtcustomerid.Text = "";
txtfname.Clear();
txtlname.Text = String.Empty;
txtdob.Text = "";


}

private void btnClear_Click(object sender, EventArgs e)
{
TextBoxClear();
}

private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}