salsedata

masterpage.aspx
<%@ Master Language="C#" AutoEventWireup="true"

CodeFile="MasterPage2.master.cs"
    Inherits="MasterPage2" %>

<!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></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
        <link rel="stylesheet" type="text/css"

href="StyleSheet.css" />
    </asp:ContentPlaceHolder>
</head>
<body>
    <form runat="server">
    <div class="wrap">
        <div class="header">
            <div class="logo">
                <a

href="http://all-free-download.com/free-website-templates/

">
                    <img src="images/logo.png" alt=""

border="0" /></a></div>
            <div id="menu">
                <ul>
                    <li class="selected"><a

href="home.aspx">home</a></li>
                    <li><a

href="Login.aspx">Gallery</a></li>
                    <li><a href="contact.aspx">contact

us</a></li>
                    <li><a href="Buy_items.aspx">Buy

items</a></li>
                    <li><asp:Button ID="Button1"

runat="server" Text="Logout" OnClick="Button1_Click"

/></li>
                </ul>
            </div>
        </div>
    </div>
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1"

runat="server">
    </asp:ContentPlaceHolder>
    </form>
</body>
</html>





master.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MasterPage2 : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        Session.Abandon();
        Response.Redirect("~/home.aspx");
    }
}



registration.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" CodeFile="Register.aspx.cs" Inherits="Register" %>
<%@ Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" tagPrefix="ajax"  %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link rel="stylesheet" type="text/css" href="StyleSheet.css" />
    <style type ="text/css">
        .stylee
        {
            font-family:Arial Baltic Arial CYR Arial Arial Greek;
            font-size:25pt;
            font-style:oblique;
            color:White;
        }
    </style>
    <script type="text/javascript">
       function cellvalidation() {

           var i = 10;
           var no = document.getElementById("TextBox10").value;

           if (i < no) {
               alert("enter proper cell number");
               document.getElementById("TextBox10").focus();
           }
           else if (no.length == 0) {
           alert("please enter phone no");
           document.getElementById("TextBox10").focus();
           }
          
       };
       </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <ajax:ToolkitScriptManager ID="Scriptmanager1" runat="server"/>

    <div>
   
                   <center> <table border="1" bordercolor="white">
                         <tr>
                                <td>
                                    <h1 class="stylee">REGISTER FORM</h1>
                                </td>
                         </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label1" ForeColor="White" runat="server" Text="company name"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                            </td><td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="please enter company name" ForeColor="Blue"
                                ControlToValidate="TextBox1">
                            </asp:RequiredFieldValidator></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label2" ForeColor="White" runat="server" Text="company address"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine"></asp:TextBox>
                            </td>
                            <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="please enter company address" ForeColor="Blue"
                                ControlToValidate="TextBox2" >
                            </asp:RequiredFieldValidator></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label3" ForeColor="White" runat="server" Text="company man_address"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox3" runat="server" TextMode="MultiLine"></asp:TextBox>
                            </td>
                            <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="please enter company address" ForeColor="Blue"
                                ControlToValidate="TextBox2" >
                            </asp:RequiredFieldValidator></td>
                        </tr>
                       
                        <tr>
                            <td>
                            <asp:Label ID="Label4" ForeColor="White" runat="server" Text="select state"></asp:Label>
                            </td>
                            <td>
                                <asp:DropDownList ID="DropDownList1" runat="server"
                                   
                                    style="height: 22px"
                                    onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="True"
                                    DataTextField="statename" DataValueField="statename"
                                    >
                                </asp:DropDownList>
                            <td>
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ErrorMessage="please enter company address" ForeColor="Red"
                                ControlToValidate="TextBox4" >
                            </asp:RequiredFieldValidator></td>--%>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label5" ForeColor="White" runat="server" Text="city"></asp:Label>
                            </td>
                            <td>
                                <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"
                                    DataTextField="city" DataValueField="city"
                                    >
                                </asp:DropDownList>
                            </td>
                            <td>
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="please enter city" ForeColor="Red"
                                ControlToValidate="TextBox5" >
                            </asp:RequiredFieldValidator></td>--%>
                       
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label6" ForeColor="White" runat="server" Text="company email"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
                            </td>
                            <td>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ForeColor="Blue" ErrorMessage="invalid email" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ControlToValidate="TextBox6">
                                </asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label7" ForeColor="White" runat="server" Text="company url"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
                            </td>
                            <td>
                            <asp:RegularExpressionValidator  
                                ID="RegularExpressionValidator2" runat="server" ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"  ForeColor="Blue" ControlToValidate="TextBox7"  ErrorMessage="Input valid Internet URL!">
                                 </asp:RegularExpressionValidator> 
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label14" runat="server" Text="company  logo"></asp:Label>
                            </td>
                            <td>
                                <asp:FileUpload ID="FileUpload1" runat="server" />
                            </td>
                            <td>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ErrorMessage="enter logo" ForeColor="Blue" ControlToValidate="FileUpload1"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label8" ForeColor="White" runat="server" Text="client name"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox8" runat="server"></asp:TextBox>
                            </td>
                            <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="please enter name" ForeColor="Blue"
                                ControlToValidate="TextBox8" >
                            </asp:RequiredFieldValidator></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label9" ForeColor="White" runat="server" Text="client address"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox9" runat="server" TextMode="MultiLine"></asp:TextBox>
                            </td>
                            <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="please enter address" ForeColor="Blue"
                                ControlToValidate="TextBox9" >
                            </asp:RequiredFieldValidator></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label10" ForeColor="White" runat="server" Text="client cellno"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox10" runat="server"
                                     ></asp:TextBox>
                            </td>
                            <td>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ForeColor="Blue"
                                ErrorMessage="add proper data" ValidationExpression="^[0-9]{10}" ControlToValidate="TextBox10"
                                ></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label11" ForeColor="White" runat="server" Text="client email"></asp:Label>
                            </td>
                            
                            <td>
                                <asp:TextBox ID="TextBox11" runat="server"></asp:TextBox>
                            </td>
                            <td>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ForeColor="Blue" ErrorMessage="invalid email" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ControlToValidate="TextBox11">
                                </asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label12" ForeColor="White" runat="server" Text="enter LoginID"></asp:Label>
                            </td>
                            
                            <td>
                                <asp:TextBox ID="TextBox12" runat="server"></asp:TextBox>
                            </td>
                            <td>
                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="please enter LoginId" ForeColor="Blue"
                                ControlToValidate="TextBox12" >
                            </asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label13" ForeColor="White" runat="server" Text="enter Password"></asp:Label>
                            </td>
                            
                            <td>
                                <asp:TextBox ID="TextBox13" runat="server" TextMode="Password"></asp:TextBox>
                            </td>
                            <td>
                                 <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="please enter Password" ForeColor="Blue"
                                ControlToValidate="TextBox12" >
                            </asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td>
                                <asp:Button ID="Button1" runat="server" Text="submit" onclick="Button1_Click" /></td>
                        </tr>
                    </table>
                </center>
   
    </div>

</asp:Content>


registration.aspx.cs

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 System.Data.SqlClient;
using System.IO;
public partial class Register : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
            Bind_ddlstate();
        //Session["unm"] = TextBox12.Text;
        //Session["pass"] = TextBox13.Text;
    }

    public void Bind_ddlstate()
    {

        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "select * from pi_statedemo";
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(q, conn);

        da.Fill(ds);

        DropDownList1.DataSource = ds;
        DropDownList1.DataBind();
        DropDownList1.Items.Insert(0, new ListItem("--select--"));
        DropDownList2.Items.Insert(0, new ListItem("--select--"));
        conn.Close();


    }
    public void Bind_ddlCity()
    {

        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "select city from pi_citydemo where id ='" + DropDownList1.SelectedIndex + "'";
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(q, conn);
        da.Fill(ds);
        DropDownList2.DataSource = ds;
        DropDownList2.DataBind();
        conn.Close();


    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        string file1 = Path.GetFileName(FileUpload1.PostedFile.FileName);
        FileUpload1.SaveAs(Server.MapPath("~/image/" + file1));
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();

        string q = "insert into pi_company(com_name,com_add,com_man_add,state,city,com_email,com_url,com_logo,cl_name,cl_add,cl_cellno,cl_email,username,password)values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + DropDownList1.SelectedValue + "','" + DropDownList2.SelectedValue + "','" + TextBox6.Text + "','" + TextBox7.Text + "','"  +"image/"+file1 + "','" + TextBox8.Text + "','" + TextBox9.Text + "','" + TextBox10.Text + "','" + TextBox11.Text + "','" + TextBox12.Text + "','" + TextBox13.Text + "')";
        SqlCommand cmd = new SqlCommand(q, conn);
        int i=cmd.ExecuteNonQuery();
        if (i > 0)
        {
            Response.Redirect("~/home.aspx");
        }
        else
        {

        }
        conn.Close();
    }

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
       Bind_ddlCity();

      
    }
}




 home.aspx

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" tagPrefix="ajax"  %>
<!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">
       <script type="text/javascript">
           function cellvalidation() {

               var i = 10;
               var no = document.getElementById("TextBox10").value;

               if (i < no) {
                   alert("enter proper cell number");
                   document.getElementById("TextBox10").focus();
               }
               else if (no.length == 0) {
               alert("please enter phone no");
               document.getElementById("TextBox10").focus();
               }
              
           };
           </script>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <ajax:ToolkitScriptManager ID="Scriptmanager1" runat="server"/>
    <div>
   
                    <table>
                        <tr>
                            <td>
                                <asp:Label ID="Label1" runat="server" Text="company name"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                            </td><td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="please enter company name" ForeColor="Red"
                                ControlToValidate="TextBox1">
                            </asp:RequiredFieldValidator></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label2" runat="server" Text="company address"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                            </td>
                            <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="please enter company address" ForeColor="Red"
                                ControlToValidate="TextBox2" >
                            </asp:RequiredFieldValidator></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label3" runat="server" Text="company man_address"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                            </td>
                            <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="please enter company address" ForeColor="Red"
                                ControlToValidate="TextBox2" >
                            </asp:RequiredFieldValidator></td>
                        </tr>
                       
                        <tr>
                            <td>
                            <asp:Label ID="Label4" runat="server" Text="select state"></asp:Label>
                            </td>
                            <td>
                                <asp:DropDownList ID="DropDownList1" runat="server"
                                   
                                    style="height: 22px"
                                    onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="True"
                                    DataTextField="statename" DataValueField="statename"
                                    >
                                </asp:DropDownList>
                            <td>
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ErrorMessage="please enter company address" ForeColor="Red"
                                ControlToValidate="TextBox4" >
                            </asp:RequiredFieldValidator></td>--%>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label5" runat="server" Text="city"></asp:Label>
                            </td>
                            <td>
                                <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"
                                    DataTextField="city" DataValueField="city"
                                    >
                                </asp:DropDownList>
                            </td>
                            <td>
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="please enter city" ForeColor="Red"
                                ControlToValidate="TextBox5" >
                            </asp:RequiredFieldValidator></td>--%>
                       
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label6" runat="server" Text="company email"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
                            </td>
                            <td>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="invalid email" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ControlToValidate="TextBox6">
                                </asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label7" runat="server" Text="company url"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
                            </td>
                            <td>
                            <asp:RegularExpressionValidator  
                                ID="RegularExpressionValidator2" runat="server" ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?" ControlToValidate="TextBox7"  ErrorMessage="Input valid Internet URL!">
                                 </asp:RegularExpressionValidator> 
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label8" runat="server" Text="client name"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox8" runat="server"></asp:TextBox>
                            </td>
                            <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="please enter name" ForeColor="Red"
                                ControlToValidate="TextBox8" >
                            </asp:RequiredFieldValidator></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label9" runat="server" Text="client address"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
                            </td>
                            <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="please enter address" ForeColor="Red"
                                ControlToValidate="TextBox9" >
                            </asp:RequiredFieldValidator></td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label10" runat="server" Text="client cellno"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="TextBox10" runat="server"
                                     ></asp:TextBox>
                            </td>
                            <td>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server"
                                ErrorMessage="add proper data" ValidationExpression="^[0-9]{10}" ControlToValidate="TextBox10"
                                ></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label11" runat="server" Text="client email"></asp:Label>
                            </td>
                            
                            <td>
                                <asp:TextBox ID="TextBox11" runat="server"></asp:TextBox>
                            </td>
                            <td>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="invalid email" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ControlToValidate="TextBox11">
                                </asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td>
                                <asp:Button ID="Button1" runat="server" Text="submit" onclick="Button1_Click" /></td>
                        </tr>
                    </table>
   
   
    </div>
    </form>
</body>
</html>


 home.aspx.cs
 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 System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!Page.IsPostBack)
        Bind_ddlstate();
      
    }

    public void Bind_ddlstate()
    {

        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "select * from pi_statedemo";
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(q, conn);

        da.Fill(ds);

        DropDownList1.DataSource = ds;
        DropDownList1.DataBind();
        DropDownList1.Items.Insert(0, new ListItem("--select--"));
        DropDownList2.Items.Insert(0,new ListItem("--select--"));
        conn.Close();
      

    }
    public void Bind_ddlCity()
    {

        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "select city from pi_citydemo where id ='"+DropDownList1.SelectedIndex+"'";
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(q, conn);
        da.Fill(ds);
        DropDownList2.DataSource = ds;
        DropDownList2.DataBind();
        conn.Close();


    }

    protected void Button1_Click(object sender, EventArgs e)
    {
         string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
         SqlConnection conn = new SqlConnection(con);
         conn.Open();
         string q = "insert into pi_company(com_name,com_add,com_man_add,state,city,com_email,com_url,cl_name,cl_add,cl_cellno,cl_email)values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + DropDownList1.SelectedValue + "','" + DropDownList2.SelectedValue + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + TextBox9.Text + "','" + TextBox10.Text + "','" + TextBox11.Text + "')";
         SqlCommand cmd = new SqlCommand(q, conn);
         cmd.ExecuteNonQuery();
         conn.Close();
    }

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Bind_ddlCity();
    }
}


Login aspx


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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link rel="stylesheet" type="text/css" href="StyleSheet.css" />

    <style type ="text/css">
        .stylee
        {
            font-family:Arial Baltic Arial CYR Arial Arial Greek;
            font-size:25pt;
            font-style:oblique;
            color:White;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table border="1" bordercolor="white">
    <tr>
        <td>
            <h1 class="stylee">LOGIN PLEASE</h1>
        </td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label1" runat="server" Text="Enter UserId" ForeColor="White"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        </td>
        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="please enter username" ForeColor="Blue"
                                ControlToValidate="TextBox1">
                            </asp:RequiredFieldValidator></td>
    </tr>
     <tr>
        <td>
            <asp:Label ID="Label2" runat="server" Text="Enter PassWord" ForeColor="White"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox>
        </td>
        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="please enter Password" ForeColor="Blue"
                                ControlToValidate="TextBox1">
                            </asp:RequiredFieldValidator></td>
    </tr>
    <tr>
        <td></td>
        <td>
            <asp:Button ID="Button1" runat="server" Text="submit" onclick="Button1_Click" /></td>
    </tr>
</table>
</asp:Content>




Login aspx

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 System.Data.SqlClient;

public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {  
      
        // = Session["unm"].ToString();
         //= Session["pass"].ToString();
       
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "select * from pi_company where username='"+TextBox1.Text+"' and password='"+TextBox2.Text+"'";
        SqlDataAdapter dr = new SqlDataAdapter(q, conn);
        DataTable dt= new DataTable();
        //bool b = dr.HasRows;
        dr.Fill(dt);
        if (dt.Rows.Count>0)
        {
            Session["lid"] = dt.Rows[0][0].ToString();
            Response.Redirect("~/menufacturecompany.aspx");
        }
        else
        {
            System.Web.HttpContext.Current.Response.Write("<SCRIPT> alert('Sorry');</SCRIPT>");
        }
      
    }
}




product.aspx

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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link rel="stylesheet" type="text/css" href="StyleSheet.css" />
<style type="text/css">
   
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Button ID="Button2" runat="server" Text="Back" onclick="Button2_Click" CausesValidation="False" />
<table>
    <tr>
        <td>
            <asp:Label ID="Label1" ForeColor="White" runat="server" Text="Product data"></asp:Label>
        </td>
    </tr>
    <tr>
            <td>
                <asp:Label ID="Label2" ForeColor="White" runat="server" Text="pro_image"></asp:Label>
            </td>
            <td>
                <asp:FileUpload ID="FileUpload1" runat="server" />
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="please enter product image" ControlToValidate="FileUpload1"></asp:RequiredFieldValidator>
            </td>
    </tr>
    <tr>
            <td>
                <asp:Label ID="Label3" ForeColor="White" runat="server" Text="pro_category"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="please enter product cetagory" ControlToValidate="TextBox2"></asp:RequiredFieldValidator>
            </td>
    </tr>
    <tr>
            <td>
                <asp:Label ID="Label4" ForeColor="White" runat="server" Text="pro_name"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="please enter produc name" ControlToValidate="TextBox3"></asp:RequiredFieldValidator>
            </td>
    </tr>
    <tr>
            <td>
                <asp:Label ID="Label5" ForeColor="White" runat="server" Text="pro_price"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="please enter product price" ControlToValidate="TextBox4"></asp:RequiredFieldValidator>
            </td>
    </tr>
    <tr>
            <td>
                <asp:Label ID="Label6" ForeColor="White" runat="server" Text="pro_quantity"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="please enter product quantity" ControlToValidate="TextBox5"></asp:RequiredFieldValidator>
            </td>
    </tr>
    <tr>
        <td>
        </td>
        <td>
            <asp:Button ID="Button1" runat="server" Text="submit" onclick="Button1_Click" />
        </td>
    </tr> 
</table>
</asp:Content>






product.aspx.cs

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 System.Data.SqlClient;
using System.IO;

public partial class product : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            //images.SaveAs(Server.MapPath("~/image/") + images.FileName);
            FileUpload1.SaveAs(Server.MapPath("~/image/") + FileUpload1.FileName);
        }
        /*string file1 = Path.GetFileName(FileUpload1.PostedFile.FileName);
           FileUpload1.SaveAs(Server.MapPath("~/image/"+file1));
           string file2=(Server.MapPath("image/")+file1);
            //file1.SaveAs(Server.MapPath("~/image/") + file1.FileName);*/
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "insert into pi_product(pro_category,pro_image,pro_name,pro_price,pro_quantity,com_id)values('" + TextBox2.Text + "','" +"image/"+FileUpload1.FileName+ "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" +Session["lid"].ToString()+"')";
        SqlCommand cmd = new SqlCommand(q, conn);
        int i = cmd.ExecuteNonQuery();
        if (i > 0)
        {
            Response.Redirect("~/menufacturecompany.aspx");
        }
        else
        {
        }

        
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/menufacturecompany.aspx");
    }
}



productList.aspx

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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link rel="stylesheet" type="text/css" href="StyleSheet.css" />
    <script type="text/javascript">
        function search1(str1) {
            if (str1 == "") {
                document.getElementById("grid").innerHTML ="";
                return;
            }
            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            }
            else {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                   // document.getElementById("grid1").style.display = 'none';
                    document.getElementById("grid").innerHTML = xmlhttp.responseText;
                }
            }
            xmlhttp.open("GET", "searchdata.aspx?q1=" + str1, true);
            xmlhttp.send();

        }
        </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <div>         
<b style="font-size: large; color:White">Enter Name to Search:</b>              
<input type="text" onkeyup="search1(this.value)"  value="" />
  </div>
 
<div id="grid"></div>
    <asp:Button ID="Button1" runat="server" Text="show data"
        onclick="Button1_Click" />
        <asp:Button ID="Button2" runat="server" Text="Back" onclick="Button2_Click" />
    <div>
       
    <asp:GridView ID="GridView1" runat="server"  AutoGenerateColumns="False"
            DataKeyNames="pro_image" ForeColor="White" PagerStyle-HorizontalAlign="Center"
            PageSize="5" onrowcancelingedit="GridView1_RowCancelingEdit"
            onrowediting="GridView1_RowEditing" onrowupdating="GridView1_RowUpdating"
            onrowdeleting="GridView1_RowDeleting">
    <Columns>
            <asp:TemplateField HeaderText="Image">
        <ItemTemplate>
            <asp:Image ID="Image1" runat="server" Width="80" Height="60" ImageUrl='<%#Eval("pro_image") %>' />
           
        </ItemTemplate>
        <EditItemTemplate>
        <asp:Label ID="Label6" runat="server" Text='<%#Eval("pro_image") %>' Visible="false"></asp:Label>
            <asp:FileUpload ID="FileUpload1" runat="server" />
        </EditItemTemplate>
        </asp:TemplateField>
      <asp:TemplateField HeaderText="comp_ID">
        <ItemTemplate>
            <asp:Label ID="Label1" runat="server" Text='<%#Eval("pro_id") %>'></asp:Label>
        </ItemTemplate>
      </asp:TemplateField>
      
       <asp:TemplateField HeaderText="categort">
        <ItemTemplate>
            <asp:Label ID="Label2" runat="server" Text='<% #Eval("pro_category") %>'></asp:Label>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="TextBox1" runat="server" Text='<% #Eval("pro_category") %>'></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="name">
        <ItemTemplate>
            <asp:Label ID="Label3" runat="server" Text='<%#Eval("pro_name") %>'></asp:Label>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="TextBox2" runat="server" Text='<%#Eval("pro_name") %>'></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="price">
        <ItemTemplate>
            <asp:Label ID="Label4" runat="server" Text='<%#Eval("pro_price") %>'></asp:Label>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="TextBox3" runat="server" Text='<%#Eval("pro_price") %>'></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="quantity">
        <ItemTemplate>
            <asp:Label ID="Label5" runat="server" Text='<%#Eval("pro_quantity") %>'></asp:Label>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="TextBox4" runat="server" Text='<%#Eval("pro_quantity") %>'></asp:TextBox>
        </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Edit">Edit</asp:LinkButton>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Update">Update</asp:LinkButton>
                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Cancel">Cancel</asp:LinkButton>
            </EditItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Delete">
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Delete">Delete</asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
       
    </Columns>
    </asp:GridView>
    </div>
   
</asp:Content>






productList.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using System.Data.SqlClient;

public partial class productList : System.Web.UI.Page
{
    Image i;
   
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public void grid()
    {
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        string q = "select pro_id, pro_image,pro_category,pro_name,pro_price,pro_quantity from pi_product where com_id='"+Session["lid"].ToString()+"'";
        SqlConnection conn = new SqlConnection(con);
        SqlCommand cmd = new SqlCommand(q, conn);
        conn.Open();
        cmd.ExecuteNonQuery();
        SqlDataAdapter sd = new SqlDataAdapter();
        DataSet ds = new DataSet();
        sd.SelectCommand = cmd;
        sd.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
       /*foreach (GridViewRow r in GridView1.Rows)
        {
            i = (Image)(GridView1.Rows[r.RowIndex].Cells[0].FindControl("Image2"));
            string s = GridView1.DataKeys[r.RowIndex].Value.ToString();
            i.ImageUrl = "~/image/" + s.ToString();
            i.DataBind();
           

        }*/
        conn.Close();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        grid();
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string q;
        Label l1 = (Label)GridView1.Rows[e.RowIndex].FindControl("Label1");
        TextBox tx1 = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox1");
        TextBox tx2 = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox2");
        TextBox tx3 = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox3");
        TextBox tx4 = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox4");
       

        FileUpload images = (FileUpload)GridView1.Rows[e.RowIndex].FindControl("FileUpload1") as FileUpload;
       
        if (images.HasFile)
        {
            images.SaveAs(Server.MapPath("~/image/") + images.FileName);
           
             q = "update pi_product set pro_category='" + tx1.Text + "',pro_image='" + "image/" + images.FileName + "',pro_name='" + tx2.Text + "',pro_price='" + tx3.Text + "',pro_quantity='" + tx4.Text + "' where pro_id='" + l1.Text + "'";
           

        }
        else
        {
            Label l2 = (Label)GridView1.Rows[e.RowIndex].FindControl("Label6");
           
             q = "update pi_product set pro_category='" + tx1.Text + "',pro_image='"  + l2.Text + "',pro_name='" + tx2.Text + "',pro_price='" + tx3.Text + "',pro_quantity='" + tx4.Text + "' where pro_id='" + l1.Text + "'";
           
        }

        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        SqlCommand cmd = new SqlCommand(q, conn);
        cmd.ExecuteNonQuery();
        GridView1.EditIndex = -1;
        grid();

       
       
    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView1.EditIndex = e.NewEditIndex;
        grid();
    }
    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        GridView1.EditIndex = -1;
        grid();

    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Label l1 = (Label)GridView1.Rows[e.RowIndex].FindControl("Label1");


        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();

        string q = "delete from pi_product where pro_id='" + l1.Text + "'";
        SqlCommand cmd = new SqlCommand(q, conn);
        cmd.ExecuteNonQuery();
        grid();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/menufacturecompany.aspx");
    }
}



searching.aspx

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

<!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></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" ForeColor="White">
        </asp:GridView>
        </div>
        <div>
        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" ForeColor="White">
        <Columns>
            <asp:TemplateField HeaderText="Image">
                <ItemTemplate>
                    <asp:Image ID="Image1" runat="server" Width="80" Height="60" ImageUrl='<%#Eval("pro_image") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="comp_ID">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("pro_id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="categort">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<% #Eval("pro_category") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="name">
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%#Eval("pro_name") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="price">
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%#Eval("pro_price") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="quantity">
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server" Text='<%#Eval("pro_quantity") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
   
   
    </form>
</body>
</html>

searching.aspx.cs

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 System.Data.SqlClient;


public partial class searchdata : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Request.QueryString["q"] != null)
            {
                string t = Request.QueryString["q"].ToString();
                // Response.Redirect("client11.aspx?name=" + t);
                string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=Demod;Password=Demo1@";
                //Menu inm = (Menu)this.Master.FindControl("Menu1");
                // '" + t + '%'+"'";

                string q1 = "select * from pi_client where client_nm like '" + t + "%' and com_id='" + Session["lid"].ToString() + "'";
                DataSet ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter();
                SqlConnection cn = new SqlConnection(con);
                SqlCommand cmd = new SqlCommand(q1, cn);
                cn.Open();
                da.SelectCommand = cmd;
                cmd.ExecuteNonQuery();
                da.Fill(ds);
                GridView1.DataSource = ds;
                GridView1.DataBind();
            }
            if (Request.QueryString["q1"] != null)
            {
                string t1 = Request.QueryString["q1"].ToString();
                string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=Demod;Password=Demo1@";
                string q = "select * from pi_product where pro_category like '" + t1 + "%' and com_id='" + Session["lid"].ToString() + "'";
                DataSet ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter();
                SqlConnection cn = new SqlConnection(con);
                SqlCommand cmd = new SqlCommand(q, cn);
                cn.Open();
                da.SelectCommand = cmd;
                cmd.ExecuteNonQuery();
                da.Fill(ds);
                GridView2.DataSource = ds;
                GridView2.DataBind();

                cn.Close();

                return;
            }

        }
    }
}




clientdata.aspx

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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link rel="stylesheet" type="text/css" href="StyleSheet.css" />

    <style type ="text/css">
        .stylee
        {
            font-family:Arial Baltic Arial CYR Arial Arial Greek;
            font-size:25pt;
            font-style:oblique;
            color:White;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Button ID="Button2" runat="server" Text="Back"
    CausesValidation="False" onclick="Button2_Click" />
    <center><h1 class="stylee">COMPANY DETAIL</h1></center>
<center><table border="1" bordercolor="white" style="height: 274px; width: 461px">
    
    <tr>
        <td>
            <asp:Label ID="Label2" runat="server" ForeColor="White" Text="clien name"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        </td>
        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="please enter company name" ForeColor="Blue"
                                ControlToValidate="TextBox2">
                            </asp:RequiredFieldValidator></td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label6" runat="server" ForeColor="White" Text="state"></asp:Label>
        </td>
        <td>
            <asp:DropDownList ID="DropDownList1" runat="server"
                                   
                                    style="height: 22px"
                                    onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="True"
                                    DataTextField="statename" DataValueField="statename"
                                    >
                                </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td>
                <asp:Label ID="Label7" runat="server" ForeColor="White" Text="city"></asp:Label>
        </td>
        <td>
            <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"
                                    DataTextField="city" DataValueField="city"
                                    >
                                </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label3" runat="server" ForeColor="White" Text="client email"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
        </td>
        <td>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ForeColor="Blue" ErrorMessage="invalid email" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ControlToValidate="TextBox3">
                                </asp:RegularExpressionValidator>
                            </td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label4" runat="server" ForeColor="White" Text="client address"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox4" runat="server" TextMode="MultiLine"></asp:TextBox>
        </td>
        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="please enter company name" ForeColor="Blue"
                                ControlToValidate="TextBox4">
                            </asp:RequiredFieldValidator></td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label5" runat="server" ForeColor="White" Text="username"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        </td>
        <td>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="TextBox1" runat="server" ErrorMessage="please add userid"></asp:RequiredFieldValidator>
        </td>                 
    </tr>
     <tr>
        <td>
            <asp:Label ID="Label1" runat="server" ForeColor="White" Text="username"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox5" TextMode="Password" runat="server"></asp:TextBox>
        </td>
        <td>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"  ControlToValidate="TextBox5" ErrorMessage="please add password"></asp:RequiredFieldValidator>
        </td>                 
    </tr>
    <tr>
        <td></td>
        <td>
           <asp:Button ID="Button1" runat="server" Text="submit" onclick="Button1_Click" />
        </td>   
    </tr>
</table></center>
 
</asp:Content>




clientdata.aspx.cs
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 System.Data.SqlClient;

public partial class clientdata : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
            Bind_ddlstate();
        //ids();

    }

    public void Bind_ddlstate()
    {

        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "select * from pi_statedemo";
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(q, conn);

        da.Fill(ds);

        DropDownList1.DataSource = ds;
        DropDownList1.DataBind();
        DropDownList1.Items.Insert(0, new ListItem("--select--"));
        DropDownList2.Items.Insert(0, new ListItem("--select--"));
        conn.Close();


    }
    public void Bind_ddlCity()
    {

        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "select city from pi_citydemo where id ='" + DropDownList1.SelectedIndex + "'";
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(q, conn);
        da.Fill(ds);
        DropDownList2.DataSource = ds;
        DropDownList2.DataBind();
        conn.Close();


    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Bind_ddlCity();
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "insert into pi_client(client_nm,client_state,client_city,client_email,client_address,username,password,com_id)values('" + TextBox2.Text + "','" + DropDownList1.SelectedValue + "','" + DropDownList2.SelectedValue + "','" + TextBox3.Text + "','" + TextBox4.Text + "','"+TextBox1.Text+"','"+TextBox5.Text+"','" + Session["lid"].ToString() +"')";
        SqlCommand cmd = new SqlCommand(q, conn);
        int i =cmd.ExecuteNonQuery();
        if (i > 0)
        {
            Response.Redirect("~/menufacturecompany.aspx");
        }
        else
        {
            Response.Redirect("~/clientdata.aspx");
        }
     
    }

    /*public void ids()
    {
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "select com_id from pi_company";
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(q, conn);

        da.Fill(ds);

        DropDownList3.DataSource = ds;
        DropDownList3.DataBind();
        conn.Close();

    }

    protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
    {
        ids();
    }*/
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/menufacturecompany.aspx");
    }
}



orderdata.aspx

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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link rel="stylesheet" type="text/css" href="StyleSheet.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   
    <asp:Button ID="Button1" runat="server" Text="Back" onclick="Button1_Click" />
    <asp:GridView ID="GridView1" runat="server" ForeColor="White"
        AutoGenerateColumns="False" DataKeyNames="order_id,status,pro_quantity">
    <Columns>
    <asp:TemplateField HeaderText="order_id" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="Label14" runat="server" Text='<%#Eval("order_id") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
    <asp:TemplateField HeaderText="pro_id" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="Label11" runat="server" Text='<%#Eval("pro_id") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
         <asp:TemplateField HeaderText="com_id" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="Label12" runat="server" Text='<%#Eval("com_id") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
         <asp:TemplateField HeaderText="client_id" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="Label13" runat="server" Text='<%#Eval("client_id") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>

        <asp:TemplateField HeaderText="clientname">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("client_nm") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="states">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%#Eval("client_state") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="city">
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%#Eval("client_city") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="address">
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%#Eval("client_address") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="email">
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server" Text='<%#Eval("client_email") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Pureches_Date">
                <ItemTemplate>
                    <asp:Label ID="Label15" runat="server" Text='<%#Eval("date") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_category">
                <ItemTemplate>
                    <asp:Label ID="Label6" runat="server" Text='<%#Eval("pro_category") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="image">
                <ItemTemplate>
                    <asp:Image ID="Image1" runat="server" ImageUrl='<%#Eval("pro_image")%>' Height="60px" Width="60px" />
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_name">
                <ItemTemplate>
                    <asp:Label ID="Label7" runat="server" Text='<%#Eval("pro_name") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
       
        <asp:TemplateField HeaderText="pro_price">
                <ItemTemplate>
                    <asp:Label ID="Label8" runat="server" Text='<%#Eval("pro_price") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_quantity">
                <ItemTemplate>
                    <asp:Label ID="Label9" runat="server" Text='<%#Eval("pro_quantity") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="total">
                <ItemTemplate>
                    <asp:Label ID="Label16" runat="server" Text='<%#Eval("total") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="status">
                <ItemTemplate>
                    <asp:Label ID="Label10" runat="server" Text='<%#Eval("status") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton1" OnClick="deliver" runat="server" CommandArgument='<%#Eval("order_id") %>' >deliver</asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    </asp:GridView>
</asp:Content>






orderdata.aspx.cs
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 System.Data.SqlClient;

public partial class orderdata : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        grid();
       
    }
    public void grid()
    {

        string con = @"Data Source=SQLDB;Initial

Catalog=Demo;User ID=DemoD;Password=Demo1@";
        //string q = "select

pi_client.client_nm,pi_client.client_state,pi_client.clien

t_city,pi_client.client_address,pi_client.client_email,pi_

clientorder.pro_category,pi_clientorder.pro_image,pi_clien

torder.pro_id,pi_clientorder.pro_name,pi_clientorder.pro_p

rice,pi_clientorder.pro_quantity,pi_clientorder.status

from pi_client INNER JOIN pi_clientorder on

pi_client.client_id=pi_clientorder.client_id where

pi_clientorder.company_id='" + Session["lid"].ToString() +

"'";
        //string q = "select

pro.pro_quantity,p.com_id,pc.client_id,pc.client_nm,pc.cli

ent_state,pc.client_city,pc.client_address,pc.client_email

,pcl.order_id,pcl.date,pcl.pro_category,pcl.pro_image,pcl.

pro_id,pcl.pro_name,pcl.pro_price,pcl.pro_quantity,pcl.tot

al,pcl.status from pi_client pc  INNER JOIN pi_clientorder

pcl on  pc.client_id=pcl.client_id INNER JOIN pi_company p

on p.com_id='"+Session["lid"].ToString()+"'INNER JOIN

pi_product pro on pro.pro_id=pcl.pro_id where

pcl.company_id='" + Session["lid"].ToString() + "'";
        string q = "select

p.com_id,pc.client_id,pc.client_nm,pc.client_state,pc.clie

nt_city,pc.client_address,pc.client_email,pcl.order_id,pcl

.date,pcl.pro_category,pcl.pro_image,pcl.pro_id,pcl.pro_na

me,pcl.pro_price,pcl.pro_quantity,pcl.total,pcl.status

from pi_client pc  INNER JOIN pi_clientorder pcl on 

pc.client_id=pcl.client_id INNER JOIN pi_company p on

p.com_id='" + Session["lid"].ToString() + "' where

pcl.company_id='" + Session["lid"].ToString() + "'";
        //string q = "select * from pi_clientorder";

        SqlConnection conn = new SqlConnection(con);
        SqlCommand cmd = new SqlCommand(q, conn);
        conn.Open();
        cmd.ExecuteNonQuery();
        SqlDataAdapter sd = new SqlDataAdapter();
        DataSet ds = new DataSet();
        sd.SelectCommand = cmd;
        sd.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }

    protected void deliver(object sender, EventArgs e)
    {

        Session["id"] =

((LinkButton)sender).CommandArgument;
        string sid = null;
        //string t = TextBox6.Text;
        string status1 = null;
        string st="deliver";
        string idd=null;
        string pro = null;
        string client_id = null;
        string com_id = null;
        foreach (GridViewRow r in GridView1.Rows)
        {
           // Label cid =

(Label)GridView1.Rows[r.RowIndex].FindControl("Label8");
          
            sid =

GridView1.DataKeys[r.RowIndex].Values[0].ToString();
            status1 =

GridView1.DataKeys[r.RowIndex].Values[1].ToString();
            //int quan = Int32.Parse(

GridView1.DataKeys[r.RowIndex].Values[2].ToString());
            Label l11 =

(Label)GridView1.Rows[r.RowIndex].FindControl("Label11");
            Label l14 =

(Label)GridView1.Rows[r.RowIndex].FindControl("Label14");
            pro = l11.Text;
            //Label l9 =

(Label)GridView1.Rows[r.RowIndex].FindControl("Label9");
            Label l10 =

(Label)GridView1.Rows[r.RowIndex].FindControl("Label110");
            if (sid.Equals(Session["id"]) &&

status1.Equals("panding"))
            {
                //status1 = "diliver";
                Label l1 =

(Label)GridView1.Rows[r.RowIndex].FindControl("Label11");
                idd = l1.Text;
                Label l2 =

(Label)GridView1.Rows[r.RowIndex].FindControl("Label12");
                com_id = l2.Text;
                Label l3 =

(Label)GridView1.Rows[r.RowIndex].FindControl("Label13");
                client_id = l3.Text;
                string con = @"Data Source=SQLDB;Initial

Catalog=Demo;User ID=DemoD;Password=Demo1@";
                string s = "update pi_clientorder set

status='" + st + "' where order_id='" + sid + "'";
                string s1 = "insert into pi_salse(com_id

,client_id,pro_id,order_id)values('" + com_id + "','" +

client_id + "','" + idd + "','" + l14.Text + "')";
                SqlConnection conn = new

SqlConnection(con);
                SqlCommand cmd = new SqlCommand(s, conn);
                SqlCommand cmd1 = new SqlCommand(s1,

conn);
                conn.Open();
                cmd.ExecuteNonQuery();
                cmd1.ExecuteNonQuery();
                conn.Close();
               /* if (quan <= Int32.Parse(l9.Text))
                {
                    //string con = @"Data

Source=SQLDB;Initial Catalog=Demo;User

ID=DemoD;Password=Demo1@";  
                   

ClientScript.RegisterClientScriptBlock(this.GetType(),

"key", "<script> alert('your quantity is less then order

quantity');</script>"); 
                    //SqlConnection conn = new

SqlConnection(con);
                    //SqlCommand cmd1 = new SqlCommand(s1,

conn);
                   

                }
                else
                {
                   
                }*/
               
               
               
                grid();
            }
        }
       


    }

    protected void Button1_Click(object sender, EventArgs

e)
    {
        Response.Redirect("~/menufacturecompany.aspx");

    }
}



client_list.aspx

<%@ Page Title="" Language="C#"

MasterPageFile="~/MasterPage2.master"

AutoEventWireup="true" CodeFile="clientList.aspx.cs"

Inherits="clientList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head"

Runat="Server">
    <link rel="stylesheet" type="text/css"

href="StyleSheet.css" />

<script type="text/javascript">
        function search1(str) {
            if (str == "") {
                document.getElementById("grid").innerHTML

="";
                return;
            }
            if (window.XMLHttpRequest) {// code for IE7+,

Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            }
            else {// code for IE6, IE5
                xmlhttp = new

ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4 &&

xmlhttp.status == 200) {
                   //

document.getElementById("grid1").style.display = 'none';
                   

document.getElementById("grid").innerHTML =

xmlhttp.responseText;
                }
            }
            xmlhttp.open("GET", "searchdata.aspx?q=" +

str, true);
            xmlhttp.send();

        }
        </script>
</asp:Content>
<asp:Content ID="Content2"

ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">


    <%--<asp:Label ID="Label1" runat="server" Text="Enter

your company id"  ForeColor="White"></asp:Label>--%>
    <%--<asp:TextBox ID="TextBox1"

runat="server"></asp:TextBox>--%>
    <div>         
<b style="font-size: large; color:White">Enter Name to

Search:</b>              
<input type="text" onkeyup="search1(this.value)"  value=""

/>
  </div>
 
<div id="grid"></div>
 <asp:Button ID="Button2" runat="server" Text="Data show"
                onclick="Button2_Click" />
   

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs

p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n

bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs

p;&nbsp;&nbsp;<asp:Button
        ID="Button3" runat="server" Text="BACK"

onclick="Button3_Click" />
   

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs

p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n

bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs

p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n

bsp;&nbsp;&nbsp;
    <asp:Button ID="Button1" runat="server" Text="Logout"

onclick="Button1_Click"/>
 <div style="overflow:auto; width:960px; height:200px" >

<asp:GridView ID="GridView1"
         runat="server" ForeColor="White" Width="100%"

AutoGenerateColumns="False"
         onrowediting="GridView1_RowEditing"

onrowupdating="GridView1_RowUpdating"
         onrowcancelingedit="GridView1_RowCancelingEdit"
         onrowcommand="GridView1_RowCommand"

onrowdeleting="GridView1_RowDeleting"
         onrowdatabound="GridView1_RowDataBound1">
 <Columns>
 <%--<asp:TemplateField HeaderText="company id">
      <ItemTemplate>
          <asp:Label ID="Label1" runat="server" Text='<%

#Eval("com_id") %>'></asp:Label>
      </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="company name">
      <ItemTemplate>
          <asp:Label ID="Label2" runat="server" Text='<%

#Eval("com_name") %>'></asp:Label>
      </ItemTemplate>
      <EditItemTemplate>
          <asp:TextBox ID="TextBox2" runat="server"

Text='<% #Eval("com_name") %>'></asp:TextBox>
      </EditItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="company address">
      <ItemTemplate>
          <asp:Label ID="Label3" runat="server" Text='<%

#Eval("com_add") %>'></asp:Label>
      </ItemTemplate>
      <EditItemTemplate>
          <asp:TextBox ID="TextBox3" runat="server"

Text='<% #Eval("com_add") %>'></asp:TextBox>
      </EditItemTemplate>
    </asp:TemplateField>
       <asp:TemplateField HeaderText="State">
            <ItemTemplate>
                <asp:Label ID="Labclstate" runat="server"

Text='<%#Eval("state") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:DropDownList ID="DropDownList3"

runat="server"

onselectedindexchanged="DropDownList3_SelectedIndexChanged

" AutoPostBack="true" DataTextField="statename"

DataValueField="id">
                </asp:DropDownList>
                <asp:RequiredFieldValidator

ID="RequiredFieldValidator1" runat="server"

ErrorMessage="please enter company name" ForeColor="Blue"
                               

ControlToValidate="DropDownList3">
                           

</asp:RequiredFieldValidator></td>
            </EditItemTemplate>
        </asp:TemplateField>
    <asp:TemplateField HeaderText="city">
    <ItemTemplate>
          <asp:Label ID="Label5" runat="server" Text='<%

#Eval("city") %>'></asp:Label>
      </ItemTemplate>
      <EditItemTemplate>
          <asp:DropDownList ID="DropDownList2"

runat="server" DataTextField="city" DataValueField="city"

AutoPostBack="true">
          </asp:DropDownList>
          <asp:RequiredFieldValidator

ID="RequiredFieldValidator2" runat="server"

ErrorMessage="please enter company name" ForeColor="Blue"
                               

ControlToValidate="DropDownList2">
                           

</asp:RequiredFieldValidator></td>
      </EditItemTemplate>
     </asp:TemplateField>
    <asp:TemplateField HeaderText="company url">
      <ItemTemplate>
          <asp:Label ID="Label6" runat="server" Text='<%

#Eval("com_url") %>'></asp:Label>
      </ItemTemplate>
      <EditItemTemplate>
          <asp:TextBox ID="TextBox6" runat="server"

Text='<% #Eval("com_url") %>'></asp:TextBox>
      </EditItemTemplate>
    </asp:TemplateField>--%>
   
   
   
   
   
    <asp:TemplateField HeaderText="client id">
      <ItemTemplate>
          <asp:Label ID="Label12" runat="server" Text='<%

#Eval("client_id") %>'></asp:Label>
      </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="contact per name ">
      <ItemTemplate>
          <asp:Label ID="Label7" runat="server" Text='<%

#Eval("client_nm") %>'></asp:Label>
      </ItemTemplate>
      <EditItemTemplate>
          <asp:TextBox ID="TextBox7" runat="server"

Text='<% #Eval("client_nm") %>'></asp:TextBox>
      </EditItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="state">
      <ItemTemplate>
          <asp:Label ID="Label8" runat="server" Text='<%

#Eval("client_state") %>'></asp:Label>
      </ItemTemplate>
      <EditItemTemplate>
         <%--<asp:TextBox ID="TextBox8" runat="server"

Text='<% #Eval("client_state") %>'></asp:TextBox>--%>
          <asp:DropDownList ID="DropDownList4"

runat="server"

onselectedindexchanged="DropDownList4_SelectedIndexChanged

" AutoPostBack="true" DataTextField="statename"

DataValueField="id"  >
          </asp:DropDownList>
          <%--<asp:Label ID="Labels" runat="server"

Text='<% #Eval("client_state") %>'

Visible="false"></asp:Label>--%>
          <asp:RequiredFieldValidator

ID="RequiredFieldValidator3" runat="server"

ErrorMessage="please enter company name" ForeColor="Blue"
                               

ControlToValidate="DropDownList4">
                           

</asp:RequiredFieldValidator></td>
                           
      </EditItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="city">
      <ItemTemplate>
          <asp:Label ID="Label9" runat="server" Text='<%

#Eval("client_city") %>'></asp:Label>
      </ItemTemplate>
     <EditItemTemplate>
          <%--<asp:TextBox ID="TextBox9" runat="server"

Text='<% #Eval("client_city") %>'></asp:TextBox>--%>
         <asp:DropDownList ID="DropDownList5"

runat="server" AutoPostBack="true" DataTextField="city"

DataValueField="city"  >
         </asp:DropDownList>
         <asp:RequiredFieldValidator

ID="RequiredFieldValidator4" runat="server"

ErrorMessage="please enter company name" ForeColor="Blue"
                               

ControlToValidate="DropDownList5">
                           

</asp:RequiredFieldValidator></td>
     </EditItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="contect address">
      <ItemTemplate>
          <asp:Label ID="Label10" runat="server" Text='<%

#Eval("client_address") %>'></asp:Label>
      </ItemTemplate>
      <EditItemTemplate>
          <asp:TextBox ID="TextBox10" runat="server"

Text='<% #Eval("client_address") %>'></asp:TextBox>
      </EditItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="client email">
      <ItemTemplate>
          <asp:Label ID="Label11" runat="server" Text='<%

#Eval("client_email") %>'></asp:Label>
      </ItemTemplate>
      <EditItemTemplate>
          <asp:TextBox ID="TextBox11" runat="server"

Text='<% #Eval("client_email") %>'></asp:TextBox>
      </EditItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="edit">
    <ItemTemplate>
        <asp:LinkButton ID="LinkButton1" runat="server"

CommandName="Edit" ToolTip="edit" ForeColor="Yellow"

CommandArgument=<%#Eval("client_id") %>

>Edit</asp:LinkButton>
    </ItemTemplate>
        <EditItemTemplate>
            <asp:LinkButton ID="LinkButton2"

runat="server" CommandName="update"

ForeColor="Yellow">update</asp:LinkButton>
            <asp:LinkButton ID="LinkButton3"

runat="server" CommandName="Cancel"

ForeColor="Yellow">Cancel</asp:LinkButton>
        </EditItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="delete">
        <ItemTemplate>
            <asp:LinkButton ID="LinkButton4"

runat="server" CommandName="Delete"

ForeColor="Yellow">Delete</asp:LinkButton>
        </ItemTemplate>
    </asp:TemplateField>
 </Columns>

    </asp:GridView></div>
    <asp:Label ID="Label1" runat="server" Text="Label"

ForeColor="White" Font-Bold="true"

Font-Size="X-Large"></asp:Label>
</asp:Content>

client_list.aspx.cs
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 System.Data.SqlClient;
public partial class clientList : System.Web.UI.Page
{
  
    protected void Page_Load(object sender, EventArgs e)
    {
      
    }
    public void grid()
    {
        string con = @"Data Source=SQLDB;Initial

Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        //string q = "select

pi_company.com_id,pi_company.com_name,pi_company.com_add,p

i_company.com_man_add,pi_company.state,pi_company.city,pi_

company.com_email,pi_company.com_url,pi_client.client_id,p

i_client.client_nm,pi_client.client_state,pi_client.client

_city,pi_client.client_address,pi_client.client_email from

pi_company  INNER JOIN pi_client  on

pi_company.com_id=pi_client.com_id where pi_company.com_id

like '" +Session["lid"].ToString() + "'";
        string q = "select * from pi_client where

com_id='" + Session["lid"].ToString() + "'";
        //string q = "select

pi.com_name,pi.com_add,pi.com_man_add,pi.state,pi.city,pi.

com_email,pi.com_url from pi_company pi INNER JOIN(select

* from pi_company where com_id=pi.com_id) as pc on

pc.com_id=pi.com_id";
      
        SqlCommand cmd = new SqlCommand(q, conn);
        //sqlcon.Open();
      
        SqlDataAdapter sd = new SqlDataAdapter();
        DataSet ds = new DataSet();
        sd.SelectCommand = cmd;
        sd.Fill(ds);
        cmd.ExecuteNonQuery();
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }

    protected void Button2_Click(object sender, EventArgs

e)
    {
        grid();
    }
    protected void GridView1_RowEditing(object sender,

GridViewEditEventArgs e)
    {
       
     
        GridView1.EditIndex = e.NewEditIndex;
        grid();
    
       
      
    }
    protected void GridView1_RowUpdating(object sender,

GridViewUpdateEventArgs e)
    {
        //Label lb1 =

(Label)GridView1.Rows[e.RowIndex].FindControl("Label1");
      
        //TextBox tx1 =

(TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox2"

);
        //TextBox tx2 =

(TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox3"

);
        //DropDownList drp =

(DropDownList)GridView1.Rows[e.RowIndex].FindControl("Drop

DownList3");
        //DropDownList drp1 =

(DropDownList)GridView1.Rows[e.RowIndex].FindControl("Drop

DownList2");
        //TextBox tx5 =

(TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox6"

);
        Label lb2 =

(Label)GridView1.Rows[e.RowIndex].FindControl("Label12");
        TextBox tx6 =

(TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox7"

);
        TextBox tx7 =

(TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox8"

);
        TextBox tx8 =

(TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox9"

);
         Label lbs =

(Label)GridView1.Rows[e.RowIndex].FindControl("Labels");
        DropDownList drpp =

(DropDownList)GridView1.Rows[e.RowIndex].FindControl("Drop

DownList4");
        DropDownList drpp1 =

(DropDownList)GridView1.Rows[e.RowIndex].FindControl("Drop

DownList5");
        TextBox tx9 =

(TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox10

");
        TextBox tx10 =

(TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox11

");
        string con = @"Data Source=SQLDB;Initial

Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q1;
        //string q = "update pi_company  set com_add='" +

tx2.Text + "',state='" + drp.Text + "',city='" + drp1.Text

+ "',com_url='" + tx5.Text + "' from pi_company where

com_id='" + lb1.Text + "'";
        if(drpp.SelectedValue=="0")
        {
            q1 = "update pi_client set client_nm='" +

tx6.Text + "',client_state='" + lbs.Text +

"',client_city='" + drpp1.Text + "',client_address='" +

tx9.Text + "',client_email='" + tx10.Text + "' from 

pi_client where client_id='" + lb2.Text + "'";
        }
        else
        {
            q1 = "update pi_client set client_nm='" +

tx6.Text + "',client_state='" + drpp.Text +

"',client_city='" + drpp1.Text + "',client_address='" +

tx9.Text + "',client_email='" + tx10.Text + "' from 

pi_client where client_id='" +lb2.Text+ "'";

        }
       // SqlCommand cmd = new SqlCommand(q, conn);
        SqlCommand cmd1 = new SqlCommand(q1, conn);
        //cmd.ExecuteNonQuery();
        cmd1.ExecuteNonQuery();
        GridView1.EditIndex = -1;
        grid();
       
    }
   
    protected void GridView1_RowCommand(object sender,

GridViewCommandEventArgs e)
    {
     
    }
protected void  GridView1_RowDeleting(object sender,

GridViewDeleteEventArgs e)
{
    //Label lb1 =

(Label)GridView1.Rows[e.RowIndex].FindControl("Label1");
    Label lb2 =

(Label)GridView1.Rows[e.RowIndex].FindControl("Label12");
    TextBox tx6 =

(TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox7"

);
    string con = @"Data Source=SQLDB;Initial

Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        //string q = "delete from pi_company where

com_id='" + lb1.Text + "'";
        string q1 = "delete  from pi_client  where

client_id='" + lb2.Text + "'";
          //      SqlCommand cmd = new SqlCommand(q,

conn);
        SqlCommand cmd1 = new SqlCommand(q1, conn);
        //cmd.ExecuteNonQuery();
        cmd1.ExecuteNonQuery();
        grid();

}
protected void GridView1_RowCancelingEdit(object sender,

GridViewCancelEditEventArgs e)
{
    GridView1.EditIndex = -1;
    grid();

}


/*protected void DropDownList3_SelectedIndexChanged(object

sender, EventArgs e)
{
    string con = @"Data Source=SQLDB;Initial

Catalog=Demo;User ID=DemoD;Password=Demo1@";
    SqlConnection conn = new SqlConnection(con);
    DataTable dt1 = new DataTable();
    DropDownList ddl3 =

this.GridView1.Rows[this.GridView1.EditIndex].FindControl(

"DropDownList3") as DropDownList;
    DropDownList ddl2 =

this.GridView1.Rows[this.GridView1.EditIndex].FindControl(

"DropDownList2") as DropDownList;
    int x = (ddl3.SelectedIndex);
    SqlDataAdapter da = new SqlDataAdapter("select city

from pi_citydemo where id=" + x + "", conn);
    da.Fill(dt1);

    ddl2.DataSource = dt1;
    ddl2.DataBind();

}*/
protected void DropDownList4_SelectedIndexChanged(object

sender, EventArgs e)
{
    string con = @"Data Source=SQLDB;Initial

Catalog=Demo;User ID=DemoD;Password=Demo1@";
    SqlConnection conn = new SqlConnection(con);
    DataTable dt2 = new DataTable();
    DropDownList ddl4 =

this.GridView1.Rows[this.GridView1.EditIndex].FindControl(

"DropDownList4") as DropDownList;
    DropDownList ddl5 =

this.GridView1.Rows[this.GridView1.EditIndex].FindControl(

"DropDownList5") as DropDownList;
    int x = (ddl4.SelectedIndex);
    SqlDataAdapter da = new SqlDataAdapter("select * from

pi_citydemo where id=" + x + "", conn);
    da.Fill(dt2);
   
    ddl5.DataSource = dt2;
    ddl5.DataBind();

}


protected void Button1_Click(object sender, EventArgs e)
{
    Session.Abandon();
    Response.Redirect("~/Login.aspx");
}
protected void Button3_Click(object sender, EventArgs e)
{
    Response.Redirect("~/menufacturecompany.aspx");
}
protected void GridView1_RowDataBound1(object sender,

GridViewRowEventArgs e)
{
    string con = @"Data Source=SQLDB;Initial

Catalog=Demo;User ID=DemoD;Password=Demo1@";
    SqlConnection conn = new SqlConnection(con);
    conn.Close();
   
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        Control ctrl1 =

e.Row.FindControl("DropDownList4");
        if (ctrl1 != null)
        {
           
            DropDownList dd1 = ctrl1 as DropDownList;
             dd1.Items.Insert(0, new

ListItem("--select--"));
            conn.Open();
            SqlCommand cmd1 = new SqlCommand("select

statename from pi_statedemo", conn);
            SqlDataReader dr1;
            dr1 = cmd1.ExecuteReader();
            while (dr1.Read())
            {
                //D2.Items.Add(dr[0].ToString());
                dd1.Items.Add(dr1[0].ToString());
            }
           
            dr1.Close();
        }
        conn.Close();
    }
    /*if (e.Row.RowType == DataControlRowType.DataRow)
    {
        //Control cc = e.Row.FindControl("DropDownList4");
        //dcity = cc as DropDownList;

        //Control cs = e.Row.FindControl("DropDownList3");
        //ds1 = cs as DropDownList;

        Control ctrl = e.Row.FindControl("DropDownList3");
      
        if (ctrl != null)
        {
            DropDownList dd = ctrl as DropDownList;
          
           dd.Items.Insert(0, new ListItem("--select--"));
           
            conn.Open();
            SqlCommand cmd = new SqlCommand("select

statename from pi_statedemo", conn);
           
            SqlDataReader dr;
         
            dr = cmd.ExecuteReader();
           
            while (dr.Read())
            {
                //D2.Items.Add(dr[0].ToString());
                dd.Items.Add(dr[0].ToString());
            }
            dr.Close();
          
        }

        conn.Close();

    }*/
}
}


clientregistrtiongroup.aspx


<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" CodeFile="clientRegistersingup.aspx.cs" Inherits="clientRegistersingup" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link rel="Stylesheet" href="StyleSheet.css" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
   
<table border="1" bordercolor="white">
    <tr>
        <td>
            <asp:Label ID="Label1" ForeColor="White" runat="server" Text="Email ID"></asp:Label>
        </td>
   
   
        <td>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>  
        </td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label2" runat="server" ForeColor="White" Text="PassWord"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>  
        </td>
    </tr>
    <tr>
        <td>
          <asp:Button ID="Button4" BackColor="#3399CC" ForeColor="White" runat="server" Text="Button" OnClientClick="return true" onclick="Button4_Click" />
        </td>
       
        <td>
            <asp:Button ID="Button2" runat="server" Text="Register" BackColor="#3399CC"
                ForeColor="White" />
            <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Button2" PopupControlID="Panel1" >
            </asp:ModalPopupExtender>
           
        </td>
    </tr>
   
</table>
   
       
   
    <%--<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>--%>
   
   
   
<asp:Panel ID="Panel1" runat="server" BackColor="#3399CC" ForeColor="White" Height="300px" Width="500px" style="display:none">
  <center>  <table border="1" bordercolor="white" style="height: 274px; width: 461px">
    
    <tr>
        <td>
            <asp:Label ID="Label3" runat="server" ForeColor="White" Text="clien name"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
        </td>
        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="please enter company name" ForeColor="Blue"
                                ControlToValidate="TextBox3">
                            </asp:RequiredFieldValidator></td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label6" runat="server" ForeColor="White" Text="state"></asp:Label>
        </td>
        <td>
            <asp:UpdatePanel runat="server">
                <ContentTemplate>
                <asp:DropDownList ID="DropDownList1" runat="server"
                    style="height: 22px" onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="True"
                    DataTextField="statename" DataValueField="statename">
                </asp:DropDownList>
                </ContentTemplate>
             </asp:UpdatePanel>
        </td>
    </tr>
    <tr>
        <td>
                <asp:Label ID="Label7" runat="server" ForeColor="White" Text="city"></asp:Label>
        </td>
        <td>
            <asp:UpdatePanel runat="server">
                <ContentTemplate>
                    <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"
                                    DataTextField="city" DataValueField="city">
                    </asp:DropDownList>
                 </ContentTemplate>
            </asp:UpdatePanel>
        </td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label4" runat="server" ForeColor="White" Text="client email"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
        </td>
        <td>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ForeColor="Blue" ErrorMessage="invalid email" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ControlToValidate="TextBox4">
                                </asp:RegularExpressionValidator>
                            </td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label5" runat="server" ForeColor="White" Text="client address"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox5" runat="server" TextMode="MultiLine"></asp:TextBox>
        </td>
        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="please enter company name" ForeColor="Blue"
                                ControlToValidate="TextBox5">
                            </asp:RequiredFieldValidator></td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label8" runat="server" ForeColor="White" Text="username"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
        </td>
        <td>
             <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="TextBox6" runat="server" ErrorMessage="please add userid"></asp:RequiredFieldValidator>
        </td>                 
    </tr>
     <tr>
        <td>
            <asp:Label ID="Label9" runat="server" ForeColor="White" Text="username"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox7" TextMode="Password" runat="server"></asp:TextBox>
        </td>
        <td>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"  ControlToValidate="TextBox7" ErrorMessage="please add password"></asp:RequiredFieldValidator>
        </td>                 
    </tr>
  
    <tr>
        <td></td>
        <td>
           <asp:Button ID="Button3" runat="server" Text="submit"
                onclick="Button3_Click1"  />
        </td>   
    </tr>
</table></center>

        </asp:Panel>
</asp:Content>





clientregistrtiongroup.aspx.cs

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 System.Data.SqlClient;
public partial class clientRegistersingup : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
            Bind_ddlstate();
    }
    public void Bind_ddlstate()
    {

        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "select * from pi_statedemo";
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(q, conn);

        da.Fill(ds);

        DropDownList1.DataSource = ds;
        DropDownList1.DataBind();
        DropDownList1.Items.Insert(0, new ListItem("--select--"));
        DropDownList2.Items.Insert(0, new ListItem("--select--"));
        conn.Close();


    }
    public void Bind_ddlCity()
    {

        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "select city from pi_citydemo where id ='" + DropDownList1.SelectedIndex + "'";
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(q, conn);
        da.Fill(ds);
        DropDownList2.DataSource = ds;
        DropDownList2.DataBind();
        conn.Close();


    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Bind_ddlCity();
    }
 
  
    protected void Button3_Click1(object sender, EventArgs e)
    {
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        string q = "insert into pi_client(client_nm,client_state,client_city,client_email,client_address,username,password,com_id)values('" + TextBox3.Text + "','" + DropDownList1.SelectedValue + "','" + DropDownList2.SelectedValue + "','" + TextBox4.Text + "','" + TextBox5.Text + "','"+TextBox6.Text+"','"+TextBox7.Text+"','" + Session["cm_id"].ToString() + "')";
        SqlCommand cmd = new SqlCommand(q, conn);
        int i = cmd.ExecuteNonQuery();
        if (i > 0)
        {
            Response.Redirect("~/Buy_items.aspx");
        }
        else
        {
            Response.Redirect("~/clientRegistersingup.aspx");
        }
    }

    /*protected void Button1_Click1(object sender, EventArgs e)
    {
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        string q = "select * from pi_client where username='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'";
        SqlConnection conn = new SqlConnection(con);
        //conn.Open();
        //SqlCommand cmd = new SqlCommand(q, conn);
        //SqlDataReader dr = cmd.ExecuteReader();
        DataTable dt = new DataTable();
        SqlDataAdapter da = new SqlDataAdapter(q, conn);
        da.Fill(dt);
        //bool b = dr.HasRows;
        if (dt.Rows.Count == 1)
        {
            Session["cid"] = dt.Rows[0][0].ToString();

            string q1 = "insert into pi_clientorder(client_id,pro_id,pro_category,pro_image,pro_name,pro_price,pro_quantity,company_id)values('" + Session["cid"].ToString() + "','" + Request.QueryString["pid"] + "','" + Request.QueryString["pcate"] + "','" + Request.QueryString["pimage"] + "','" + Request.QueryString["pnm"] + "','" + Request.QueryString["ppri"] + "','" + Request.QueryString["pqu"] + "','" + Request.QueryString["cmid"].ToString() + "')";
            conn.Open();
            SqlCommand cmd1 = new SqlCommand(q1, conn);
            int i = cmd1.ExecuteNonQuery();
            if (i > 0)
            {
                Session["cm_id"] = null;
                System.Web.HttpContext.Current.Response.Write("<SCRIPT> alert('your data is collected');</SCRIPT>");
            }
            else
            {
                System.Web.HttpContext.Current.Response.Write("<SCRIPT> alert(' Sorry!!!! please try again');</SCRIPT>");
            }

        }
        else
        {
            System.Web.HttpContext.Current.Response.Write("<SCRIPT> alert('So Sorry!!!!');</SCRIPT>");
        }
    }
    /*protected void Button4_Click(object sender, EventArgs e)
    {
      
    }*/
    /*protected void Button1_Click(object sender, EventArgs e)
    {
       


       
      
    }*/
    protected void Button4_Click(object sender, EventArgs e)
    {
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        //string q = "select client_nm,client_state,client_city,client_email,client_address,username,password from pi_client where username='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'";
        string q = "select * from pi_client where username='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'";
        SqlConnection conn = new SqlConnection(con);
        //conn.Open();
        //SqlCommand cmd1 = new SqlCommand(q, conn);
        //SqlDataReader dr = cmd.ExecuteReader();
        DataTable dt = new DataTable();
        DataTable dt1 = new DataTable();
        SqlDataAdapter da = new SqlDataAdapter(q, conn);
        da.Fill(dt);

        dt1 = dt;  
        int tmp=0;
        string cnm = null;
        string cstate = null;
        string ccity = null;
        string cadd = null;
        string cemail = null;
        string unm = null;
        string pass = null;

            for (int r = 0; r < dt1.Rows.Count; r++)
            {
               
                cnm=dt.Rows[r][1].ToString();
                cstate = dt.Rows[r][2].ToString();
                ccity = dt.Rows[r][3].ToString();
                cadd = dt.Rows[r][4].ToString();
                cemail = dt.Rows[r][5].ToString();
                unm = dt.Rows[r][6].ToString();
                pass = dt.Rows[r][7].ToString();

                string comid = dt.Rows[r][8].ToString();
               
                string c = Request.QueryString["cmid"].ToString();
                if (comid.Equals(c))
                {
                    tmp = 1;
                    break;
                }
               
            }
                if(tmp !=1)
                {
                    string q2 = "insert into pi_client(client_nm,client_state,client_city,client_address,client_email,username,password,com_id) values ('" + cnm + "','" + cstate + "','" + ccity + "','" + cadd + "','" + cemail + "','" + unm + "','" + pass + "','" + Request.QueryString["cmid"].ToString() + "')"; //+ g1.Cells[5].Text +
                    SqlCommand cmd = new SqlCommand(q2, conn);
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    conn.Close();
                }
               
          
       

        //bool b = dr.HasRows;
        if (dt.Rows.Count > 0)
        {
            int pro_quantity = 1;
            Session["cid"] = dt.Rows[0][0].ToString();
            int total = Int32.Parse(Request.QueryString["ppri"].ToString());
            string status = "panding";
            string q1 = "insert into pi_clientorder(client_id,pro_id,pro_category,pro_image,pro_name,pro_price,pro_quantity,total,date,status,company_id)values('" + Session["cid"].ToString() + "','" + Request.QueryString["pid"] + "','" + Request.QueryString["pcate"] + "','" + Request.QueryString["pimage"] + "','" + Request.QueryString["pnm"] + "','" + Request.QueryString["ppri"] + "','" + pro_quantity + "','"+total+"','"+System.DateTime.Now.ToString("d")+"','"+status+"','" + Request.QueryString["cmid"].ToString() + "')";
           
          

            conn.Open();
            SqlCommand cmd1 = new SqlCommand(q1, conn);
            int i = cmd1.ExecuteNonQuery();
            if (i > 0)
            {
                Session["cm_id"] = null;
                Session["cid"] = null;
                System.Web.HttpContext.Current.Response.Write("<SCRIPT> alert('your data is collected');</SCRIPT>");
                Response.Redirect("~/Buy_items.aspx");
            }
            else
            {
                System.Web.HttpContext.Current.Response.Write("<SCRIPT> alert(' Sorry!!!! please try again');</SCRIPT>");
            }

        }
        else
        {
            System.Web.HttpContext.Current.Response.Write("<SCRIPT> alert('So Sorry!!!!');</SCRIPT>");
        }
    }
   
   
   
}



contact.aspx


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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link rel="stylesheet" type="text/css" href="StyleSheet.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <div class="main_content">
    <div class="left_content">
      <h1>Contact Us</h1>
      <div class="contact_form">
        <div class="form_row">
          <label class="contact">name:</label>
          <input type="text" class="contact_input" />
        </div>
        <div class="form_row">
          <label class="contact">email:</label>
          <input type="text" class="contact_input" />
        </div>
        <div class="form_row">
          <label class="contact">phone:</label>
          <input type="text" class="contact_input" />
        </div>
        <div class="form_row">
          <label class="contact">message:</label>
          <textarea class="contact_textarea" rows="" cols="" ></textarea>
        </div>
        <div class="form_row">
          <input type="image" src="images/send.gif" class="send"/>
        </div>
      </div>
    </div>
    </div>
    <div class="right_content">
      <h1>Contact Informations</h1>
      <div class="contact_info"> <span class="orange">Adress:</span>
        <p class="info_contact"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
      </div>
      <div class="contact_info"> <span class="orange">Email:</span>
        <p class="info_contact"> info@company.com </p>
      </div>
      <div class="contact_info"> <span class="orange">Phone:</span>
        <p class="info_contact"> 008 900 800 32   /    008 900 800 32 </p>
      </div>
      <div class="employe_box_left"> <span class="blue">Employe name</span><br />
        <span class="orange">Email:</span> info@company.com<br />
        <span class="orange">Phone:</span> 008 900 800 32 <br />
        <img src="images/contact_thumb1.gif" alt="" /> </div>
      <div class="employe_box_right"> <span class="blue">Employe name</span><br />
        <span class="orange">Email:</span> info@company.com<br />
        <span class="orange">Phone:</span> 008 900 800 32 <br />
        <img src="images/contact_thumb2.gif" alt="" /> </div>
    </div>

</asp:Content>








contact.aspx.cs


showclientorder.aspx




<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" CodeFile="~/showclientorder.aspx.cs" Inherits="showclientorder" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link rel="Stylesheet" href="StyleSheet.css" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table border="1" bordercolor="white">
    <tr>
        <td>
            <asp:Label ID="Label1" ForeColor="White" runat="server" Text="Email ID"></asp:Label>
        </td>
   
   
        <td>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>  
        </td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label2" runat="server" ForeColor="White" Text="PassWord"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>  
        </td>
    </tr>
    <tr>
        <td></td>
        <td>
            <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
        </td>
    </tr>
</table>
<asp:GridView ID="GridView3" runat="server" ForeColor="White"
        DataKeyNames="client_id" AutoGenerateColumns="False" AllowPaging="true" PageSize="4"
                    PagerSettings-Mode="Numeric" PagerStyle-Font-Overline="true" PagerStyle-Font-Underline="true"
                    PagerStyle-Font-Bold="true" PagerStyle-ForeColor="Yellow"
                          onpageindexchanging="GridView3_PageIndexChanging"
        onrowcancelingedit="GridView3_RowCancelingEdit"
        onrowediting="GridView3_RowEditing" onrowupdating="GridView3_RowUpdating"
        onrowdeleting="GridView3_RowDeleting" ShowFooter="true"
        onrowdatabound="GridView3_RowDataBound1" >
        <Columns>
        <asp:TemplateField HeaderText="client_id" Visible="false">
            <ItemTemplate>
                <asp:Label ID="Label13" runat="server" Text='<%#Eval("order_id") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="client_id" Visible="false">
            <ItemTemplate>
                <asp:Label ID="Label11" runat="server" Text='<%#Eval("client_id") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_id" Visible="false">
            <ItemTemplate>
                <asp:Label ID="Label10" runat="server" Text='<%#Eval("pro_id") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
         <asp:TemplateField HeaderText="pro_category">
            <ItemTemplate>
                <asp:Label ID="Label4" runat="server" Text='<%#Eval("pro_category") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_image">
            <ItemTemplate>
                <asp:Image ID="Image2" runat="server" ImageUrl='<%#Eval("pro_image") %>' Width="80" Height="80" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_name">
            <ItemTemplate>
                <asp:Label ID="Label5" runat="server" Text='<%#Eval("pro_name") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_price">
            <ItemTemplate>
                <asp:Label ID="Label6" runat="server" Text='<%#Eval("pro_price") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_quantity">
            <ItemTemplate>
                <asp:Label ID="Label7" runat="server" Text='<%#Eval("pro_quantity") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="TextBox8" runat="server" Text='<%#Eval("pro_quantity") %>'></asp:TextBox>
            </EditItemTemplate>
            <FooterTemplate>
                <asp:Label ID="Label9" runat="server" Text="Grand total is"></asp:Label>
            </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="total">
            <ItemTemplate>
                <asp:Label ID="Label3" runat="server" Text='<%#Eval("total") %>'></asp:Label>
            </ItemTemplate>
            <FooterTemplate>
                <asp:Label ID="Label8" runat="server" Text='<%#Eval("total") %>'></asp:Label>
            </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="date">
            <ItemTemplate>
                <asp:Label ID="Label12" runat="server" Text='<%#Eval("date") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="edit">
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="return true" CommandName="Edit">Edit</asp:LinkButton>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="update">update</asp:LinkButton>
                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Cancel">Cancel</asp:LinkButton>
            </EditItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Delete">
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Delete">Delete</asp:LinkButton>
            </ItemTemplate>
         </asp:TemplateField>
       
       
        </Columns>
    </asp:GridView>
</asp:Content>



showclientorder.aspx.cs
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 System.Data.SqlClient;

public partial class showclientorder : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        grid();
    }
   
    public void grid()
    {
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        string q = "select * from pi_client where username='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'";
        SqlConnection conn = new SqlConnection(con);
        conn.Open();
        SqlDataAdapter da = new SqlDataAdapter(q, conn);
        DataTable dt = new DataTable();

        da.Fill(dt);
        conn.Close();
        if (dt.Rows.Count > 0)
        {
            Session["client"] = dt.Rows[0][0].ToString();
            string q1 = "select order_id,client_id,pro_id, pro_category,pro_image,pro_name,pro_price,pro_quantity,pro_price*pro_quantity as total,date  from pi_clientorder where client_id='" + Session["client"].ToString() + "'";
            SqlCommand cmd1 = new SqlCommand(q1, conn);
            SqlDataAdapter sd = new SqlDataAdapter();
            DataSet ds = new DataSet();
            conn.Open();
            sd.SelectCommand = cmd1;
            sd.Fill(ds);
            GridView3.DataSource = ds;
            GridView3.DataBind();
            conn.Close();
        }

    }
    protected void GridView3_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView3.PageIndex = e.NewPageIndex;
        this.grid();
    }
    protected void GridView3_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        GridView3.EditIndex = -1;
        grid();
    }

    protected void GridView3_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label l1 = (Label)GridView3.Rows[e.RowIndex].FindControl("Label10");
        Label l2 = (Label)GridView3.Rows[e.RowIndex].FindControl("Label13");
        TextBox tx = (TextBox)GridView3.Rows[e.RowIndex].FindControl("TextBox8");
        int tx1 = Int32.Parse(tx.Text);
        string s = "update pi_clientorder set pro_quantity='" + tx.Text + "',total=(pro_price*pro_quantity) where order_id='" + l2.Text + "'";
        string s1 = "update pi_clientorder set total=(pro_price*pro_quantity) where order_id='" + l2.Text + "'";
        string s2 = "update pi_product set pro_quantity=(pro_quantity- '"+tx1+"' ) where pro_id='" + l1.Text + "'";
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        SqlCommand cmd = new SqlCommand(s, conn);
        SqlCommand cmd1 = new SqlCommand(s1, conn);
        SqlCommand cmd2 = new SqlCommand(s2, conn);
        conn.Open();
        cmd.ExecuteNonQuery();
        cmd1.ExecuteNonQuery();
        cmd2.ExecuteNonQuery();
        GridView3.EditIndex = -1;
        grid();


    }
    protected void GridView3_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView3.EditIndex = e.NewEditIndex;
        grid();
    }  
    protected void GridView3_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Label l1 = (Label)GridView3.Rows[e.RowIndex].FindControl("Label13");
        string s = "delete from pi_clientorder where order_id='" + l1.Text + "'";
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        SqlCommand cmd = new SqlCommand(s, conn);
        conn.Open();
        cmd.ExecuteNonQuery();
        grid();
    }
    /*public string totaldata()
    {
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        SqlConnection conn = new SqlConnection(con);
        string q = "select sum(total) from pi_clientorder ";
        SqlCommand cmd = new SqlCommand(q, conn);
        conn.Open();
        string to = cmd.ExecuteScalar().ToString();
       

        return to;

    }*/
    protected void GridView3_RowDataBound1(object sender, GridViewRowEventArgs e)
    {
        string  sid=null;
        foreach (GridViewRow r in GridView3.Rows)
        {
              sid = GridView3.DataKeys[r.RowIndex].Values[0].ToString();
        }
       
        if (e.Row.RowType == DataControlRowType.Footer)
        {
            string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
            SqlConnection conn = new SqlConnection(con);
            string q = "select sum(total) from pi_clientorder where client_id='"+sid.ToString()+"'";
            SqlCommand cmd = new SqlCommand(q, conn);
            conn.Open();
            string to = cmd.ExecuteScalar().ToString();
            Label tot = (Label)e.Row.FindControl("Label8");
            tot.Text = to.ToString();
        }
    }
}




salsedata.aspx


<%@ Page Title="" Language="C#"

MasterPageFile="~/MasterPage2.master"

AutoEventWireup="true" CodeFile="salsedata.aspx.cs"

Inherits="salsedata" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head"

Runat="Server">
    <link rel="stylesheet" type="text/css"

href="StyleSheet.css" />
</asp:Content>
<asp:Content ID="Content2" 

ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Button ID="Button1" runat="server" Text="Back"

onclick="Button1_Click" />
<asp:GridView ID="GridView1" runat="server"

ForeColor="White"
        AutoGenerateColumns="False"

DataKeyNames="pro_id,company_id" ShowFooter="true"
        onrowdatabound="GridView1_RowDataBound">
    <Columns>
    <asp:TemplateField HeaderText="pro_id">
                <ItemTemplate>
                    <asp:Label ID="Label11" runat="server"

Text='<%#Eval("pro_id") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
         <asp:TemplateField HeaderText="com_id"

Visible="false">
                <ItemTemplate>
                    <asp:Label ID="Label12" runat="server"

Text='<%#Eval("company_id") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
         <%--<asp:TemplateField HeaderText="client_id"

Visible="false">
                <ItemTemplate>
                    <asp:Label ID="Label13" runat="server"

Text='<%#Eval("client_id") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>--%>

        <asp:TemplateField HeaderText="clientname">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server"

Text='<%#Eval("client_nm") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="states">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server"

Text='<%#Eval("client_state") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="city">
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server"

Text='<%#Eval("client_city") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="address">
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server"

Text='<%#Eval("client_address") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="email">
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server"

Text='<%#Eval("client_email") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="purches_date">
                <ItemTemplate>
                    <asp:Label ID="Label10" runat="server"

Text='<%#Eval("date") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_category">
                <ItemTemplate>
                    <asp:Label ID="Label6" runat="server"

Text='<%#Eval("pro_category") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="image">
                <ItemTemplate>
                    <asp:Image ID="Image1" runat="server"

ImageUrl='<%#Eval("pro_image") %>' Height="60px"

Width="60px" />
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_name">
                <ItemTemplate>
                    <asp:Label ID="Label7" runat="server"

Text='<%#Eval("pro_name") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
       
        <asp:TemplateField HeaderText="pro_price">
                <ItemTemplate>
                    <asp:Label ID="Label8" runat="server"

Text='<%#Eval("pro_price") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_quantity">
                <ItemTemplate>
                    <asp:Label ID="Label9" runat="server"

Text='<%#Eval("pro_quantity") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                <asp:Label ID="Label16" runat="server"

Text="Grand total is"></asp:Label>
            </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="total">
                <ItemTemplate>
                    <asp:Label ID="Label11" runat="server"

Text='<%#Eval("total") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                <asp:Label ID="Label17" runat="server"

Text='<%#Eval("total") %>'></asp:Label>
            </FooterTemplate>

        </asp:TemplateField>
        <asp:TemplateField HeaderText="status">
                <ItemTemplate>
                    <asp:Label ID="Label12" runat="server"

Text='<%#Eval("status") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>
        <%--<asp:TemplateField HeaderText="status">
                <ItemTemplate>
                    <asp:Label ID="Label10" runat="server"

Text='<%#Eval("status") %>'></asp:Label>
                </ItemTemplate>
        </asp:TemplateField>--%>
        <%--<asp:TemplateField>
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton1"

OnClick="deliver" runat="server"

CommandArgument='<%#Eval("pro_id") %>'

>deliver</asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>--%>
    </Columns>
    </asp:GridView>
</asp:Content>


salsedata.aspx.cs

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 System.Data.SqlClient;

public partial class salsedata : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        grid();
    }
    public void grid()
    {

        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        //string q = "select pi_client.client_nm,pi_client.client_state,pi_client.client_city,pi_client.client_address,pi_client.client_email,pi_clientorder.pro_category,pi_clientorder.pro_image,pi_clientorder.pro_id,pi_clientorder.pro_name,pi_clientorder.pro_price,pi_clientorder.pro_quantity,pi_clientorder.status from pi_client INNER JOIN pi_clientorder on pi_client.client_id=pi_clientorder.client_id where pi_clientorder.company_id='" + Session["lid"].ToString() + "'";
        string q = "select pc.client_nm,pc.client_state,pc.client_city,pc.client_address,pc.client_email,pcl.company_id,pcl.date,pcl.pro_category,pcl.pro_image,pcl.pro_id,pcl.pro_name,pcl.pro_price,pcl.pro_quantity,pcl.total,pcl.status from pi_client pc  INNER JOIN pi_salse sl on  pc.client_id=sl.client_id INNER JOIN pi_clientorder pcl on pcl.order_id=sl.order_id INNER JOIN pi_company p on sl.com_id=p.com_id where p.com_id='" + Session["lid"].ToString() + "' and sl.client_id=pc.client_id";//
        // string q = "select

        SqlConnection conn = new SqlConnection(con);
        SqlCommand cmd = new SqlCommand(q, conn);
        conn.Open();
        cmd.ExecuteNonQuery();
        SqlDataAdapter sd = new SqlDataAdapter();
        DataSet ds = new DataSet();
        sd.SelectCommand = cmd;
        sd.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/menufacturecompany.aspx");
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        string sid = null;
        foreach (GridViewRow r in GridView1.Rows)
        {
            sid = GridView1.DataKeys[r.RowIndex].Values[1].ToString();
        }

        if (e.Row.RowType == DataControlRowType.Footer)
        {
            string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
            SqlConnection conn = new SqlConnection(con);
            string q = "select sum(total) from pi_clientorder where company_id='" + sid.ToString() +"'";
            SqlCommand cmd = new SqlCommand(q, conn);
            conn.Open();
            string to = cmd.ExecuteScalar().ToString();
            Label tot = (Label)e.Row.FindControl("Label17");
            tot.Text = to.ToString();
        }
    }
}


buy_item.aspx



<%@ Page Title="" Language="C#"

MasterPageFile="~/MasterPage2.master"

AutoEventWireup="true" CodeFile="Buy_items.aspx.cs"

Inherits="Buy_items" %>

<%@ Register Assembly="AjaxControlToolkit"

Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head"

Runat="Server">
    <link rel="Stylesheet" type="text/css"

href="StyleSheet.css" />
    <script type="text/javascript">
       
    </script>
</asp:Content>
<asp:Content ID="Content2"

ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:Button ID="Button1" runat="server" Text="show

items"
        onclick="Button1_Click" />
   <table id="tb">
    <tr>
        <td>
                <asp:GridView ID="GridView1"

runat="server" ForeColor="White"
        AutoGenerateColumns="False" DataKeyNames="com_id"

AllowPaging="true" PageSize="4"
                    PagerSettings-Mode="Numeric"

PagerStyle-Font-Overline="true"

PagerStyle-Font-Underline="true"
                    PagerStyle-Font-Bold="true"

PagerStyle-ForeColor="Yellow"
                   

onpageindexchanging="GridView1_PageIndexChanging"  >
    <Columns>
        <asp:TemplateField HeaderText="id"

Visible="false">
            <ItemTemplate>
                <asp:Label ID="Label2" runat="server"

Text='<%#Eval("com_id") %>' Visible="false"></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="logo">
            <ItemTemplate>
            <asp:Image ID="Image1" runat="server"

Width="80" Height="60" ImageUrl='<%#Eval("com_logo")%>' />
        </ItemTemplate>
        </asp:TemplateField >
        <asp:TemplateField HeaderText="company name">
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server"

Text='<%#Eval("com_name") %>' ></asp:Label>
                 <%--<asp:LinkButton ID="LinkButton4"

runat="server" Height="30px" Width="120px"

PostBackUrl="~/Seat_Selection.aspx" Text='<%#

Eval("com_name") %>'></asp:LinkButton>--%>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="show com_items">
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton1"

runat="server" OnClick="show"

CommandArgument='<%#Eval("com_id")

%>'>show</asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    </asp:GridView>
        </td>
        <td>
        <asp:GridView ID="GridView2" runat="server"

ForeColor="White"
        AutoGenerateColumns="False" ShowFooter="true"

DataKeyNames="pro_id,pro_quantity">
    <Columns>
  
        <asp:TemplateField HeaderText="ID"

Visible="false">
            <ItemTemplate>
                <asp:Label ID="Label8" runat="server"

Text='<%#Eval("pro_id") %>' ></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_category">
            <ItemTemplate>
                <asp:Label ID="Label4" runat="server"

Text='<%#Eval("pro_category") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_image">
            <ItemTemplate>
                <asp:Image ID="Image2" runat="server"

ImageUrl='<%#Eval("pro_image") %>' Width="80" Height="80"

/>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_name">
            <ItemTemplate>
                <asp:Label ID="Label5" runat="server"

Text='<%#Eval("pro_name") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_price">
            <ItemTemplate>
                <asp:Label ID="Label6" runat="server"

Text='<%#Eval("pro_price") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="pro_quantity">
            <ItemTemplate>
                <asp:Label ID="Label7" runat="server"

Text='<%#Eval("pro_quantity") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="show com_items">
        <HeaderTemplate>
            <%--<asp:LinkButton ID="LinkButton3"

runat="server"  Font-Bold="true"

CommandName="Login">Login</asp:LinkButton>--%>
            <%--<asp:ModalPopupExtender

ID="ModalPopupExtender1" runat="server"

TargetControlID="LinkButton3" PopupControlID="Panel1" >
            </asp:ModalPopupExtender>--%>
            </HeaderTemplate>
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton1"

runat="server" OnClick="add"

CommandArgument='<%#Eval("pro_id")

%>'>add</asp:LinkButton>
            </ItemTemplate>
            <%--<FooterTemplate>
                <asp:LinkButton ID="LinkButton2"

runat="server" Font-Bold="true"

CommandName="Register">Register</asp:LinkButton>
            </FooterTemplate>--%>
        </asp:TemplateField>
       
       
    </Columns>
    </asp:GridView>
       
  
    <asp:Label ID="Label3" runat="server"

ForeColor="White" Font-Size="XX-Large"

Text="Label"></asp:Label>
   
    </td>
     </tr>
   </table>
    <%--<asp:Panel ID="Panel1" runat="server"

BackColor="#3399CC" ForeColor="White" Height="100px"

Width="300px" style="display:none">
    <table>
        <tr>
            <td>
                <asp:Label ID="Label9" runat="server"

Text="UserId"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox1" runat="server"

Width="150px"></asp:TextBox>
            </td>
        </tr>
         <tr>
            <td>
                <asp:Label ID="Label10" runat="server"

Text="Password"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox2" runat="server"

TextMode="Password" Width="150px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button1" runat="server"

Text="submit" OnClick="submit" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button2" runat="server"

Text="Register" />
            </td>
        </tr>
    </table>
    </asp:Panel>--%>
</asp:Content>








buy_item.aspx.cs
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 System.Data.SqlClient;

public partial class Buy_items : System.Web.UI.Page
{
   
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            grid();
        }
    }
    public void grid()
    {
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        string q = "select com_id,com_logo,com_name from pi_company";
        SqlConnection conn = new SqlConnection(con);
        SqlCommand cmd = new SqlCommand(q, conn);
        conn.Open();
        cmd.ExecuteNonQuery();
        SqlDataAdapter sd = new SqlDataAdapter();
        DataSet ds = new DataSet();
        sd.SelectCommand = cmd;
        sd.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();

    }



  
      
    protected void show(object sender, EventArgs e)
    {
        string id = null;

        id = ((LinkButton)sender).CommandArgument;
        //string s = null;
        foreach (GridViewRow r in GridView1.Rows)
        {
            string sid = GridView1.DataKeys[r.RowIndex].Values[0].ToString();
            if (sid.Equals(id))
            {
                //Label l1 = (Label)GridView1.Rows[i].FindControl("Label2");
                Label l1 = (Label)GridView1.Rows[r.RowIndex].FindControl("Label2");
               //cm_id = l1.Text;
               Session["cm_id"] = l1.Text;
            }
        }
        Label3.Text = Session["cm_id"].ToString();
        //DropDownList ddl4 = this.GridView1.Rows[this.GridView1.EditIndex].FindControl("DropDownList4") as DropDownList;
            //Label l1 = this.GridView1.Rows[this.GridView1.EditIndex].FindControl("Label2") as Label;
           
            string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
            string q = "select * from pi_product where com_id='" + Session["cm_id"].ToString() +"'";
            SqlConnection conn = new SqlConnection(con);
            SqlCommand cmd = new SqlCommand(q, conn);
            conn.Open();
            cmd.ExecuteNonQuery();
            SqlDataAdapter sd = new SqlDataAdapter();
            DataSet ds = new DataSet();
            sd.SelectCommand = cmd;
            sd.Fill(ds);
            GridView2.DataSource = ds;
            GridView2.DataBind();
       
    }
    protected void add(object sender, EventArgs e)
    {
        string id = null;
        id = ((LinkButton)sender).CommandArgument;
       // string cm_id = null;
        string p_id = null;
        string p_nm = null;
        string p_pri = null;
        string p_qu = null;
        string p_cate = null;
        string p_image = null;
        int quantity1 = 0;
        int quan = 0;
       /* foreach (GridViewRow r in GridView1.Rows)
        {
            string sid = GridView1.DataKeys[r.RowIndex].Values[0].ToString();
            if (sid.Equals(id))
            {
                //Label l1 = (Label)GridView1.Rows[i].FindControl("Label2");
                Label l1 = (Label)GridView1.Rows[r.RowIndex].FindControl("Label2");
                cm_id = l1.Text;
            }
        }*/
        foreach (GridViewRow r in GridView2.Rows)
        {
            string sid1 = GridView2.DataKeys[r.RowIndex].Values[0].ToString();
            

            if (sid1.Equals(id))
            {
                //string s = (GridView2.DataKeys[r.RowIndex].Values[1].ToString());
                //quan = Int32.Parse(s.ToString());
                //Label l1 = (Label)GridView1.Rows[i].FindControl("Label2");
                Label l2 = (Label)GridView2.Rows[r.RowIndex].Cells[0].FindControl("Label8");
                p_id = l2.Text;
                Label l3 = (Label)GridView2.Rows[r.RowIndex].FindControl("Label5");
                p_nm = l3.Text;
                Label l4 = (Label)GridView2.Rows[r.RowIndex].FindControl("Label4");
                p_cate = l4.Text;
                Label l5 = (Label)GridView2.Rows[r.RowIndex].FindControl("Label6");
                p_pri = l5.Text;
                Label l6 = (Label)GridView2.Rows[r.RowIndex].FindControl("Label7");
                p_qu = l6.Text;
                Image i1 = (Image)GridView2.Rows[r.RowIndex].FindControl("Image2");
                p_image = i1.ImageUrl;
                Label quant = (Label)GridView2.Rows[r.RowIndex].FindControl("Label7");
                quantity1 = Int32.Parse(quant.Text);

            }
        }
        if (quantity1<1)
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "key", "<script> alert('your quantity is greater then product quantity');</script>"); 
        }
        else
        {
            Response.Redirect("~/clientRegistersingup.aspx?cmid=" + Session["cm_id"].ToString() + "&pid=" + p_id + "&pnm=" + p_nm + "&pcate=" + p_cate + "&ppri=" + p_pri + "&pqu=" + p_qu + "&pimage=" + p_image + "");
        }
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        this.grid();
    }
    /*protected void submit(object sender, EventArgs e)
    {
        string con = @"Data Source=SQLDB;Initial Catalog=Demo;User ID=DemoD;Password=Demo1@";
        string q = "select * from pi_company where username='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'";
        SqlConnection conn = new SqlConnection(con);
        SqlCommand cmd = new SqlCommand(q, conn);
        conn.Open();
        int i = cmd.ExecuteNonQuery();
        if (i > 0)
        {
           
        }
        else
        {
        }
    }*/


    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/showclientorder.aspx");
    }
}



menufecturecompany.aspx

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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link rel="stylesheet" type="text/css" href="StyleSheet.css" />

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Button ID="Button1" runat="server" Text="Logout" onclick="Button1_Click" />
    <
            <div id="menu">
                <ul>
                    <li class="selected"><a href="clientdata.aspx">Add client</a></li>
                    <li><a href="clientList.aspx">show client</a></li>
                    <li><a href="product.aspx">add product</a></li>
                    <li><a href="productList.aspx">show product</a></li>
                    <li><a href="orderdata.aspx">Order data</a></li>
                    <li><a href="salsedata.aspx">salsedata</a></li>
                   
                </ul>
            </div>
    
<%--<table>
    <tr>
        <td>
            <a href="clientdata.aspx"><h3 style="color:Yellow"><u>Add the new company</u></h3></a>
           
        </td>
   </tr>
   <tr>
        <td>
            <a href="clientList.aspx"><h3 style="color:Yellow"><u>Show your company detail</u></h3></a>
           
        </td>
   </tr>
    <tr>
        <td>
            <a href="product.aspx"><h3 style="color:Yellow"><u>add your product </u></h3></a>
           
        </td>
   </tr>
   <tr>
        <td>
            <a href="productList.aspx"><h3 style="color:Yellow"><u>Show your product detail</u></h3></a>
           
        </td>
   </tr>
   <tr>
        <td>
            <a href="client_order.aspx"><h3 style="color:Yellow"><u>Detail of client order</u></h3></a>
           
        </td>
   </tr>
</table>--%>
</asp:Content>



menufecturecompany.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class menufacturecompany :

System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs

e)
    {
        Session.Abandon();
        Response.Redirect("~/home.aspx");
    }
}



0 comments :