Total Pageviews

11 June 2012

How to make Login POP UP in ASP.net

Here I will represent a article in this article we are using some code of asp.net Loin popup when click any given link.Hope this article helpfull for you...................
Procedure=>First of all open default3.aspx page and make header and body then implement this code

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    <script type="text/javascript" runat="server">
    protected void bt_click(object sender, EventArgs e)
    {
        System.Data.SqlClient.SqlCommand cmd;
        System.Data.SqlClient.SqlConnection con;
        string s = ConfigurationManager.ConnectionStrings["con"].ToString();
        con = new System.Data.SqlClient.SqlConnection(s);
        con.Open();
        cmd = new System.Data.SqlClient.SqlCommand("select * from admin_login where User_name=@User_name and Password=@Password", con);
        cmd.Parameters.AddWithValue(@"User_name", tg1.Text);
        cmd.Parameters.AddWithValue(@"Password", TextBox1.Text);
        System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();
        if (dr.Read())
        {
            Response.Redirect("navigation URL");

        }
        con.Close();
    }    
       
       
    </script>
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <a onmouseover='this.style.cursor="pointer" ' onfocus='this.blur();' onclick="document.getElementById('PopUp').style.display = 'block' " ><span style="text-decoration: underline;">Web Cam</span></a>
    <div id='PopUp' style='display: none; positioN:inherit; left: 50px; top: 50px; border: solid black 1px; padding: 10px; background-color: rgb(255,255,225); text-align: justify; font-size: 12px; width: 300px;'>
       <table><tr><td>UserName</td><td><asp:TextBox ID="tg1" runat="server"></asp:TextBox></td></tr>
    <tr><td>password</td><td><asp:TextBox ID="TextBox1" runat="server" TextMode="Password"></asp:TextBox></td></tr>
    <tr><td></td><td><asp:Button ID="bt" runat="server" Text="Submit" OnClick="bt_click" /></td></tr>
    </table>
       <br />
       <div style='text-align: right;'><a onmouseover='this.style.cursor="pointer" ' style='font-size: 12px;' onfocus='this.blur();' onclick="document.getElementById('PopUp').style.display = 'none' " ><span style="text-decoration: underline;">Close</span></a></div>
       </div>
      </asp:Content>

4 June 2012

How Make menu bar in Site master page in ASP.net

Here I will represent a article in this article we are using some code of asp.net for using site master home page and set the browser Copatibility set for any browser.Hope this article helpfull for you...................




<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
    <title></title>
    <%--<script language="JavaScript1.1">
<!--

/*
JavaScript Image slideshow:
By JavaScript Kit (www.javascriptkit.com)
Over 200+ free JavaScript here!
*/

var slideimages=new Array()
var slidelinks=new Array()
function slideshowimages(){
for (i=0;i<slideshowimages.arguments.length;i++){
slideimages[i]=new Image()
slideimages[i].src=slideshowimages.arguments[i]
}
}

function slideshowlinks(){
for (i=0;i<slideshowlinks.arguments.length;i++)
slidelinks[i]=slideshowlinks.arguments[i]
}

function gotoshow(){
if (!window.winslide||winslide.closed)
winslide=window.open(slidelinks[whichlink])
else
winslide.location=slidelinks[whichlink]
winslide.focus()
}

//-->
</script>--%>
    <%--<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />--%>
    <link href="~/Styles/Style.css" rel="Stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
    <style type="text/css">
        .main
        {
        }
        .main
        {            height: 19px;
            }
        .style1
        {
            width: 1079px;
        }
        </style>
</head>
<body>
<form runat="server">
    <table class="page" runat="server"><tr><td class="style1">
    <div class="top1 x" align="center">
 
          <p align="left">
<a href="Default.aspx" class="top_home x">Home </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:DropDownList ID="DropDownList1" runat="server" ForeColor="#000015"
                    Width="197px">
                    <asp:ListItem>Select</asp:ListItem>
                    <asp:ListItem>Hindi</asp:ListItem>
                    <asp:ListItem>Spanish</asp:ListItem>
                    <asp:ListItem>Gujrati</asp:ListItem>
                    <asp:ListItem>Bengali</asp:ListItem>
                </asp:DropDownList>
             

&nbsp;<span class="top_on x"><a href="About.aspx" class="top_abo x">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; About Us</a>
<a href="Services.aspx" class="top_all x">Services</a>
<a href="Languages.aspx" class="top_all x">Languages</a>
<a href="quality-measure.aspx" class="top_all x"> Quality Measures</a>
                <a href="Career.aspx" class="top_all x">Careers</a>
                <a href="Odering.aspx" class="top_all x">Odering</a>
<a href="Contactus.aspx" class="top_all x"> Contact Us</a></span>

             </p></div>
             </td></tr>
        <%--<a href="javascript:gotoshow()"><img src="cnt_bbul.jpg" name="slide" border=0
            style="width: 980px; height: 197px"></a>--%>
<%--<script>
<!--

    //configure the paths of the images, plus corresponding target links
    slideshowimages("cnt_bbul.jpg", "cnt_bul.jpg", "cnt_gbul.jpg", "cnt_ibox.jpg", "cnt_ibox1.jpg")
    slideshowlinks("http://food.epicurious.com/run/recipe/view?id=13285", "http://food.epicurious.com/run/recipe/view?id=10092", "http://food.epicurious.com/run/recipe/view?id=100975", "http://food.epicurious.com/run/recipe/view?id=2876", "http://food.epicurious.com/run/recipe/view?id=20010")

    //configure the speed of the slideshow, in miliseconds
    var slideshowspeed = 2000

    var whichlink = 0
    var whichimage = 0
    function slideit() {
        if (!document.images)
            return
        document.images.slide.src = slideimages[whichimage].src
        whichlink = whichimage
        if (whichimage < slideimages.length - 1)
            whichimage++
        else
            whichimage = 0
        setTimeout("slideit()", slideshowspeed)
    }
    slideit()

//-->
</script>--%>
        <tr><td class="style1">
             <div class="main" align="center">
            <asp:ContentPlaceHolder ID="MainContent" runat="server"></asp:ContentPlaceHolder>
         
       </div></td></tr><tr><td class="style1">
                <div class="footer">
             
<table class="footer">
<tr>
<td style="height: 16px; width: 990px">
<p class="foo_bg x" align="right">
<a href="#" class="foo_home x">Home</a>
 
<a href="#" class="foo_abo x"> About Us</a>&nbsp;&nbsp;
 
<a href="#" class="foo_abo x"> Services </a>
 
<a href="#" class="foo_abo x"> Solutions  </a>
 
<a href="#" class="foo_abo x"> Quality </a>
 
<a href="#" class="foo_abo x"> Contact</a></p>
</td>
</tr>
</table>
                </div>
       
         </td></tr></table>
  </form>
</body>
</html>

1 June 2012

How use Image Slider in ASP.net Using Java Script

Here I will represent a article in this article we are using a slider which using any header of project that means master page the main important things this slider changes different diffrent color or image as you use in project.Hope this article helpfull for you...................

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!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>
    <script language="JavaScript1.1">
<!--
/*
JavaScript Image slideshow:
By JavaScript Kit (http://www.javascriptkit.com/)
Over 200+ free JavaScript here!
*/
var slideimages=new Array()
var slidelinks=new Array()
function slideshowimages(){
for (i=0;i<slideshowimages.arguments.length;i++){
slideimages[i]=new Image()
slideimages[i].src=slideshowimages.arguments[i]
}
}
function slideshowlinks(){
for (i=0;i<slideshowlinks.arguments.length;i++)
slidelinks[i]=slideshowlinks.arguments[i]
}
function gotoshow(){
if (!window.winslide||winslide.closed)
winslide=window.open(slidelinks[whichlink])
else
winslide.location=slidelinks[whichlink]
winslide.focus()
}
//-->
</script>
    <%--<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />--%>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
     <a href="javascript:gotoshow()"><img src="cnt_bbul.jpg" name="slide" border=0
            style="width: 980px; height: 197px"></a>
<script>

    //configure the paths of the images, plus corresponding target links
    slideshowimages("cnt_bbul.jpg", "cnt_bul.jpg", "cnt_gbul.jpg", "cnt_ibox.jpg", "cnt_ibox1.jpg")
    slideshowlinks("http://ambrosia-amrit.blogspot.in/2012/05/aspnet-web-template-with-extension.html", "http://ambrosia-amrit.blogspot.in/2012/05/how-to-use-link-button-in-gridview.html", "http://ambrosia-amrit.blogspot.in/2012/05/how-show-value-in-grid-view-in-aspnet_07.html", "http://ambrosia-amrit.blogspot.in/2012/05/how-use-popup-on-mouse-eventb-in-aspnet.html", "http://ambrosia-amrit.blogspot.in/2012/05/how-delete-check-box-wise-in-grid-view.html")
    //configure the speed of the slideshow, in miliseconds
    var slideshowspeed = 2000
    var whichlink = 0
    var whichimage = 0
    function slideit() {
        if (!document.images)
            return
        document.images.slide.src = slideimages[whichimage].src
        whichlink = whichimage
        if (whichimage < slideimages.length - 1)
            whichimage++
        else
            whichimage = 0
        setTimeout("slideit()", slideshowspeed)
    }
    slideit()

</script>
    </div>
    </form>
</body>
</html>

How change background color in ASP.net

Here I will represent a article in this article we are using some code in asp.net in this article back ground colors are changes.Hope this article helpfull for you...................
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!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>
    <script language="JavaScript" type="text/javascript">
function changecolor(code)
 {
document.bgColor=code
}
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <input type="button" name="Button1" value="RED" onclick="changecolor('red')"/>
<input type="button" name="Button2" value="GREEN" onclick="changecolor('green')"/>
<input type="button" name="Button3" value="BLUE" onclick="changecolor('blue')"/>
<input type="button" name="Button4" value="WHITE" onclick="changecolor('white')"/>

    </div>
    </form>
</body>
</html>

7 May 2012

How show value in Grid view in ASP.Net


<%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="About.aspx.cs" Inherits="About" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <asp:GridView ID="GridView1" runat="server"
        >
    </asp:GridView>
</asp:Content>
/////////////////////////////////
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.Configuration;
using System.IO;
public partial class About : System.Web.UI.Page
{
    SqlConnection con;
    SqlCommand cmd;
    string s = ConfigurationManager.ConnectionStrings["conn"].ToString();
    protected void Page_Load(object sender, EventArgs e)
    {
        con = new SqlConnection(s);
       if (!IsPostBack)
        {
            BindGridView();
        }
    }
    public void BindGridView()
    {
        SqlDataAdapter ad = new SqlDataAdapter("select * from Employees order by EmployeeID", con);
        DataSet ds = new DataSet(); ad.Fill(ds);
        GridView1.DataSource = ds; GridView1.DataBind();
    }

   
}

How delete value check box wise in ASP.Net



<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
     

</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
         <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
             AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="CustomerID"
             Width="41px" CellPadding="4" ForeColor="#333333" GridLines="None"
             onselectedindexchanged="GridView1_SelectedIndexChanged" Height="32px">   
        
               <Columns>         
                       <asp:CommandField ShowSelectButton="True" />
                                         <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" InsertVisible="False" ReadOnly="True" /> 
                                                         <asp:BoundField DataField="Firstname" HeaderText="Firstname"  />                 
                                                         <asp:TemplateField HeaderText="Select">
                                                                               <ItemTemplate>   
                                                                                                     
                                                                                                     
                                         <asp:CheckBox ID="chkSelect" runat="server" />    </ItemTemplate>  <HeaderTemplate>
                                        <%--<input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server" type="checkbox" />--%>     
                                         
                                                     </HeaderTemplate>         
                                                             </asp:TemplateField>       
                                                                  </Columns>   
                                                                       </asp:GridView>       
<br />
<br />        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Delete" /> 
       <asp:Label ID="lblmsg" runat="server" Text="Label" Visible="false"></asp:Label>
</asp:Content>
////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class _Default : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ToString()); 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindGridView();
        }
    }
    public void BindGridView()
    {
        SqlDataAdapter ad = new SqlDataAdapter("select * from tbl_CustomerDetail order by CustomerID", con);
        DataSet ds = new DataSet(); ad.Fill(ds);
        GridView1.DataSource = ds; GridView1.DataBind();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in GridView1.Rows)
        {
            CheckBox cb = ((CheckBox)(row.FindControl("chkSelect")));
            if (cb != null && cb.Checked)
            {
                int custID = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value);
                string sqlstr = "delete from tbl_CustomerDetail where CustomerID='" + custID + "'"; SqlCommand mycmd;
                mycmd = new SqlCommand(sqlstr, con);
                con.Open();
                mycmd.ExecuteNonQuery();
                BindGridView();
            }
            con.Close();
        }
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
    }
}

How to use Link button in Gridview

About.aspx=>
<%@ Page Title="About Us" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="About.aspx.cs" Inherits="About" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
        <div class="infobox" style="width: 700px; margin: 30px auto">
                <h2>
                    User Profile
                </h2>
                <div class="padding10">
                    <table cellspacing="0" border="0" cellpadding="8" style="width: 90%">
                        <tr>
                            <td align="right" style="width:160px">
                                Username:</td>
                            <td>
                                <asp:Label ID="lblUsername" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Gender:</td>
                            <td>
                                <asp:Label ID="lblSex" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td align="right">
                                Age:</td>
                            <td>
                                <asp:Label ID="lblAge" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td align="right">
                                Location:</td>
                            <td>
                                <asp:Label ID="lblLocation" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Occupation:</td>
                            <td>
                                <asp:Label ID="lblOccupation" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td align="right">
                                Interests:</td>
                            <td>
                                <asp:Label ID="lblInterests" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Joined:</td>
                            <td>
                                <asp:Label ID="lblJoined" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Last login:</td>
                            <td>
                                <asp:Label ID="lblLastLogin" runat="server"></asp:Label>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
</asp:Content>
About.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.Configuration;
public partial class About : System.Web.UI.Page
{
    SqlConnection con;
    string s = ConfigurationManager.ConnectionStrings["conn"].ToString();
    protected void Page_Load(object sender, EventArgs e)
    {
        con = new SqlConnection(s);
        SqlDataAdapter ad = new SqlDataAdapter("select * from Employees order by EmployeeID", con);
        string FirstName = "";
   if (this.Request.QueryString["FirstName"] == null)
   {
    return;
   }
            FirstName = Request.QueryString["FirstName"];
   DataSet ds = new DataSet();
            ad.Fill(ds);
   if (ds.Tables[0].Rows.Count == 0)
   {
    return;
   }
   DataRow row = ds.Tables[0].Rows[0];
 
   this.lblUsername.Text = row["FirstName"].ToString();
   this.lblLocation.Text = row["LastName"].ToString();
   this.lblOccupation.Text = row["Address"].ToString();
   this.lblLastLogin.Text = row["City"].ToString();
   this.lblJoined.Text = row["Region"].ToString();
            this.lblAge.Text = row["PostalCode"].ToString();
 
  }
    }

Contact Form

Name

Email *

Message *