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>

Contact Form

Name

Email *

Message *