Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 419
  • Last Modified:

on submit verify username and load same page with successful login instruction and if invalid user then error message to re-enter username

hi,
   I have an Password Request .aspx page which accept the username and checks the email address in the database and if the username exists in the database then send the auto email to the user with the new password.Now my problem is that i had put the text box to accept the username and one button to continue the process,if user enter his username and if it is correct then on the same page a instruction shoud appear that "An email has been send to ur email id with the password" and if the username is incorrect then another instrunction should appear on the same page that "Incorrecct user name and  enter again". NOW HOW do i manage this two instrunction on same page and how do i hide intruction of invalid username when username is corrent and how do i hide information of the successful username when username is incorrect, i want to manupulate all these thing in same page only.I had already write the code on the button_click event the code to send the email but i m not able to manage these hiding and unhiding of information of successful and unsuccessful login on same page.

plz help me out
0
vikram_lashkari
Asked:
vikram_lashkari
  • 3
1 Solution
 
trevorhartmanCommented:
Use a label, and set its Visible property to true or false, as needed
0
 
vikram_lashkariAuthor Commented:
no label will not do as i donot have to have to just display "login sucessfully " when the user has entered the correct username but i also need to hide the button and test box,i have done this by setting the visibile property of the table true and false but it is not working as after the suceesfful login also it is showing the table here is the code of PasswordRequest.aspx and PasswordRequest.aspx.cc.

<###########################################>

<code of PasswordRequest.aspx>
<%@ Page language="c#" Codebehind="PasswordRequest.aspx.cs" AutoEventWireup="false" Inherits="Coral.PasswordRequest" %>
<%@ Register TagPrefix="VIK" TagName="Header" Src="Header.ascx" %>
<%@ Register TagPrefix="VIK" TagName="Footer" Src="footer.ascx" %>
<%@ Register TagPrefix="VIK" TagName="TodayOfferMenu" Src="TodayOffer.ascx" %>
<%@ Register TagPrefix="VIK" TagName="BluetoothCatMenu" Src="BluetoothCategory.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
      <HEAD>
            <title>Bluetooth</title>
            <meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
            <meta content="C#" name="CODE_LANGUAGE">
            <meta content="JavaScript" name="vs_defaultClientScript">
            <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
            <style type="text/css" media="screen">@import url( /CSS/CoralCSS.css );
            </style>
      </HEAD>
      <BODY bottomMargin="0" leftMargin="0" background="ImageFile/pagebg.jpg" topMargin="0" rightMargin="0" marginheight="0" marginwidth="0">
            <center>
                  <form id="PasswordRequestMainPage" method="post" runat="server">
                        <table id="PRMain_Table" cellSpacing="0" cellPadding="0" width="776" bgColor="#ffffff">
                              <tr>
                                    <td colSpan="5"><VIK:HEADER id="Header" runat="server"></VIK:HEADER></td>
                              </tr>
                              <tr>
                                    <TD width="18" background="ImageFile/topleft4.jpg"><IMG alt="" src="ImageFile/topleft4.jpg" border="0">
                                    </TD>
                                    <TD id="For_left_menu_and_todays_offer_table" style="WIDTH: 125px" vAlign="top"><VIK:BLUETOOTHCATMENU id="BluetoothCatMenu" runat="server"></VIK:BLUETOOTHCATMENU><br>
                                          <VIK:TODAYOFFERMENU id="TodayOfferMenu" runat="server"></VIK:TODAYOFFERMENU><br>
                                    </TD>
                                    <td style="WIDTH: 600px" vAlign="top"><font style="FONT-SIZE: 20px; COLOR: maroon; FONT-FAMILY: Verdana">Password
                                                Request</font>
                                          <center>
                                                <table id="EmailRequest" style="BORDER-RIGHT: black 1px ridge; BORDER-TOP: black 1px ridge; BORDER-LEFT: black 1px ridge; WIDTH: 600px; BORDER-BOTTOM: black 1px ridge; HEIGHT: 732px" runat="server">
                                                      <tr>
                                                            <td id="CenterData" style="WIDTH: 500px; HEIGHT: 54px" vAlign="top" colSpan="2"><font style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Verdana">
                                                                        <p align="justify">You have forgotten your password. Don't worry, we all have too
                                                                              much to remember these days, simply enter your email address below and we'll
                                                                              re-send you your password.
                                                                        </p>
                                                                  </font>
                                                            </td>
                                                      </tr>
                                                      <tr>
                                                            <td style="WIDTH: 147px; HEIGHT: 36px" vAlign="top"><font style="FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: black; FONT-FAMILY: Verdana">Email
                                                                        Address : </font>
                                                            </td>
                                                            <td style="HEIGHT: 36px" vAlign="top"><asp:textbox id="EmailAddress" Width="247px" Font-Size="11px" Font-Name="Verdana" Runat="server"></asp:textbox></td>
                                                      </tr>
                                                      <tr>
                                                            <td vAlign="top" align="left" colSpan="2"><asp:button id="Continue" Runat="server" Text="Continue"></asp:button></td>
                                                      </tr>
                                                </table>
                                                <table id="EmailSucess" style="BORDER-RIGHT: black 1px ridge; BORDER-TOP: black 1px ridge; BORDER-LEFT: black 1px ridge; WIDTH: 600px; BORDER-BOTTOM: black 1px ridge; HEIGHT: 732px" runat="server">
                                                      <tr>
                                                            <td id="CenterDataSucess" style="WIDTH: 500px; HEIGHT: 54px" vAlign="top" colSpan="2"><font style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Verdana">
                                                                        <p align="justify">Your password has been emailed to your Email Address.
                                                                        </p>
                                                                  </font>
                                                            </td>
                                                      </tr>
                                                </table>
                                          </center>
                                    </td>
                                    <td id="for_top_10_best_seller_and_other_top" style="WIDTH: 1px"></td>
                                    <TD background="ImageFile/topright4.jpg"><IMG height="10" alt="" src="ImageFile/topright4.jpg" width="14" border="0">
                                    </TD>
                              </tr>
                              <tr>
                                    <td colSpan="5"><VIK:FOOTER id="Footer" runat="server"></VIK:FOOTER></td>
                              </tr>
                        </table>
                  </form>
            </center>
      </BODY>
</HTML>
<#############################################Page ---2 ##############################################>
<code of PasswordRequest.aspx.cc>

namespace Coral
{
      //Developed by vikram Lashkari on 24 Aug 2004
      using System;
      using System.Collections;
      using System.ComponentModel;
      using System.Data;
      using System.Data.OleDb;
      using System.Drawing;
      using System.Web;
      using System.Web.SessionState;
      using System.Web.UI;
      using System.Web.UI.WebControls;
      using System.Web.UI.HtmlControls;
      using System.Web.Mail;
      using System.IO;
      /// <summary>
      /// Summary description for PasswordRequest.
      /// </summary>
      public class PasswordRequest : System.Web.UI.Page
      {
            protected CCUtility Utility;
            protected System.Web.UI.WebControls.TextBox EmailAddress;
            protected System.Web.UI.WebControls.Button Continue;
            protected System.Web.UI.HtmlControls.HtmlForm PasswordRequestMainPage;
            protected System.Web.UI.HtmlControls.HtmlTable EmailRequest;
            protected System.Web.UI.HtmlControls.HtmlTable EmailSucess;
            string sInvalidEmail;
            protected bool blnEmailTable ;
            private void Page_Load(object sender, System.EventArgs e)
            {
                  Utility = new CCUtility(this);
                  if(IsPostBack)
                  {
                        if (blnEmailTable == true )
                        {
                              EmailRequest.Visible=true;
                              EmailSucess.Visible=false;
                        }
                        else
                        {
                              EmailRequest.Visible=false;
                              EmailSucess.Visible=true;
                        }
                        sInvalidEmail ="Invalid Email Address";
                  }
                  else
                  {
                        sInvalidEmail="";
                        EmailRequest.Visible=true;
                        EmailSucess.Visible=false;
                  }
            }
            
      protected void Page_Unload(object sender,EventArgs e)
      {
            if(Utility !=null) Utility.DBClose();
      }

      protected void Page_Init(object sender ,EventArgs e)
      {
                                          
      }

      protected void Page_Show(object sender ,EventArgs e)
      {

      }

      public PasswordRequest()
      {
            this.Init +=new System.EventHandler(Page_Init);
      }

      void Continue_Click(object Src, System.EventArgs E)
      {

            int iPassed =Convert.ToInt32(Utility.Dlookup("Customer_Master"," count(*)"," Cust_Email='" + EmailAddress.Text  +"'"));
            if (iPassed > 0)
            {
                  string sMessage;
                  string sPassEmail;
                  sPassEmail = Utility.Dlookup("Customer_Master","Cust_Password","Cust_Email='" + EmailAddress.Text + "'" );

                  sMessage = "";
                  sMessage += "Dear Customer <BR> <BR>";
                  sMessage += " As requested, your password for BluetoothDirect.co.uk is contained below. <BR><BR> ";
                  sMessage += " Email Address :  " + EmailAddress.Text  + "<BR>" ;
                  sMessage += " Password :" + sPassEmail ;
                  
                  
                  MailMessage myMessage;
                  myMessage = new MailMessage();
                  myMessage.To = EmailAddress.Text;
                  myMessage.From = "webmaster@bluetoothdirect.co.uk";
                  myMessage.Subject = "Your New Passowrd Request";
                  myMessage.BodyFormat = MailFormat.Html ;
                  myMessage.Body = sMessage;


                  
                  SmtpMail.Send(myMessage);                        
                  blnEmailTable = false;
            }
            else
            {
                  blnEmailTable=true;

            }



      }
            #region Web Form Designer generated code
      override protected void OnInit(EventArgs e)
      {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
      }
                  
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
      private void InitializeComponent()
      {    
            this.Continue.Click += new System.EventHandler(this.Continue_Click);
            this.Load += new System.EventHandler(this.Page_Load);

      }
            #endregion
      }
}


--------------------------------------------------------------
plz help me ou
0
 
vikram_lashkariAuthor Commented:
oh....Thanx.. i found the solution .. i can handle these all things with

   <asp:panel>

  </asp:panel>


   so thanx to you all friends who try to help me now i amd able to hide and unhide the sucessful and failure detail

  This request i want to close now,,thanx alot to friends who tried to guide me.
0
 
vikram_lashkariAuthor Commented:
Hi Administrator,

Plz close this request as i myselft found the reply of this question and i had written the solution just above this comment ,so please close this request.

thanx
Vikram Lashkari
0
 
Computer101Commented:
PAQed, with points refunded (50)

Computer101
E-E Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now