Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
AnswerRe: hi Pin
Keith Barrow9-Dec-12 23:36
professionalKeith Barrow9-Dec-12 23:36 
AnswerRe: hi Pin
V.10-Dec-12 1:37
professionalV.10-Dec-12 1:37 
GeneralRe: hi Pin
Dave Kreskowiak10-Dec-12 2:18
mveDave Kreskowiak10-Dec-12 2:18 
AnswerRe: hi Pin
Abhinav S10-Dec-12 19:57
Abhinav S10-Dec-12 19:57 
Questionhi Pin
Sowmiya ravi9-Dec-12 22:22
Sowmiya ravi9-Dec-12 22:22 
AnswerRe: hi Pin
J4amieC9-Dec-12 23:02
J4amieC9-Dec-12 23:02 
AnswerRe: hi Pin
Keith Barrow9-Dec-12 23:37
professionalKeith Barrow9-Dec-12 23:37 
Questionasp.net and c# login and register page Pin
Member 80648029-Dec-12 21:46
Member 80648029-Dec-12 21:46 
Hi all,

I'm new and making a login and register page
The register page form here is-
XML
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="register.aspx.cs" Inherits="register" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
    .style1
    {
        width: 100%;
    }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table class="style1">
    <tr>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            &nbsp;</td>
        <td>
            First
            Name</td>
        <td>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        </td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            &nbsp;</td>
        <td>
            Last name</td>
        <td>
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        </td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            &nbsp;</td>
        <td>
            E-Mail</td>
        <td>
            <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
        </td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            &nbsp;</td>
        <td>
            Password</td>
        <td>
            <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
        </td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td>
            <asp:Button ID="Button1" runat="server" Text="Login" onclick="Button1_Click" />
        &nbsp;
            <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Clear" />
        </td>
        <td>
            &nbsp;</td>
    </tr>
</table>
</asp:Content>



and register page logic code is----

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

public partial class register : System.Web.UI.Page
{
string conn = ConfigurationManager.ConnectionStrings["cnn"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
/* string query1 = "select * from tbl_Students";
SqlConnection con = new SqlConnection(conn);
con.Open();
SqlCommand cmd = new SqlCommand(query1,con);
string temp = cmd.ExecuteScalar().ToString();
System.Console.WriteLine("result is:",temp);
//Label1.Text = true;
*/
string query = "Insert into tbl_Students values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "')";
SqlConnection con = new SqlConnection(conn);
con.Open();
SqlCommand cmd = new SqlCommand(query, con);

cmd.ExecuteNonQuery();
con.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{

TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
}
}


and login page form is---

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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <p>
    user name :<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</p>
<p>
    password :<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</p>
<p>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button ID="Button1" runat="server" Text="Login" />
    &nbsp;</p>
</asp:Content>



the register page data is inserted properly but i want proper validation with e-mail id must be unique for validation ...........

please help me ............Thanks a lot ..............
AnswerRe: asp.net and c# login and register page Pin
Vaibhav Kharejoshi9-Dec-12 22:35
Vaibhav Kharejoshi9-Dec-12 22:35 
Questionthe use of Lambda and action delegate Pin
Tridip Bhattacharjee9-Dec-12 21:17
professionalTridip Bhattacharjee9-Dec-12 21:17 
AnswerRe: the use of Lambda and action delegate Pin
Eddy Vluggen9-Dec-12 23:04
professionalEddy Vluggen9-Dec-12 23:04 
AnswerRe: the use of Lambda and action delegate Pin
Freak309-Dec-12 23:11
Freak309-Dec-12 23:11 
QuestionI thought understood file io Pin
David C# Hobbyist.9-Dec-12 10:10
professionalDavid C# Hobbyist.9-Dec-12 10:10 
AnswerRe: I thought understood file io Pin
Wendelius9-Dec-12 10:29
mentorWendelius9-Dec-12 10:29 
AnswerRe: I thought understood file io Pin
Dave Kreskowiak9-Dec-12 12:23
mveDave Kreskowiak9-Dec-12 12:23 
AnswerRe: I thought understood file io Pin
Pete O'Hanlon9-Dec-12 18:20
mvePete O'Hanlon9-Dec-12 18:20 
QuestionWhat's the relation of delegate and threading Pin
mohammadkaab9-Dec-12 8:09
mohammadkaab9-Dec-12 8:09 
AnswerRe: What's the relation of delegate and threading Pin
Shameel10-Dec-12 21:19
professionalShameel10-Dec-12 21:19 
QuestionHow to pass variables from main window to Html file Pin
amiraf1239-Dec-12 3:43
amiraf1239-Dec-12 3:43 
AnswerRe: How to pass variables from main window to Html file Pin
Eddy Vluggen9-Dec-12 23:09
professionalEddy Vluggen9-Dec-12 23:09 
GeneralRe: How to pass variables from main window to Html file Pin
amiraf12310-Dec-12 0:51
amiraf12310-Dec-12 0:51 
GeneralRe: How to pass variables from main window to Html file Pin
Eddy Vluggen10-Dec-12 1:48
professionalEddy Vluggen10-Dec-12 1:48 
GeneralRe: How to pass variables from main window to Html file Pin
amiraf12310-Dec-12 2:36
amiraf12310-Dec-12 2:36 
GeneralRe: How to pass variables from main window to Html file Pin
Eddy Vluggen10-Dec-12 3:00
professionalEddy Vluggen10-Dec-12 3:00 
GeneralRe: How to pass variables from main window to Html file Pin
amiraf12310-Dec-12 3:36
amiraf12310-Dec-12 3:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.