Checkout: Customer Login
Previous  Top  Next

This page does not apply to the Lite version of the cart.

In this section we will set-up the customer login page, open the file cart/login.aspx and you should see the following form.

clip0076

First thing to do is to insert a Cart control clip0011giving it an ID of "Cart1" as on the previous pages

Next insert a Customer Login control clip0048 and the following dialog will appear:

clip0077

Define the following properties as shown in the dialog image:

ID = Login1.
ConnectionString = ConStr.
DBtable = Customers.
DataBaseType = OleDb.
Cart = Select "Cart1" from the dropdown box.
UserNameDBField = Select "EmailAddress" from the dropdown box.
PasswordDBField = Select "LoginPass" from the dropdown box.
CustomerIdDBField = Select "CustomerID" from the dropdown box.
UserNameFormField = Select "frmUserName" from the dropdown box.
PasswordFormField = Select "frmPass" from the dropdown box.
LoginSuccessURL = browse and select the cart/getcustinfo.aspx page.

Once these properties have been defined click the "OK" button and the "webxelcart:login" tag will be inserted into the page.

When the customer fills in their email address and password then submits the form the login controls will check the database for a record that has the value typed into the frmUserName field as it's EmailAddress and the value typed into the frmPass field as it's LoginPass, if a record is found the user is logged in and the users data is stored in the Cart selected in the Cart dropdown box and then is redirected to the "getcustinfo.aspx" page where the data is shown in the form.

if no matching record is found the "LoginFailed" event is raised which will execute the event procedure we are going to define next.

To define the LoginFailed event procedure select the webxelcart:login control clip0048 and then click the "Wire Event..." button on the property inspector, once the event selection dialog appears select "LoginFailed" from the dropdown box and click "OK", the following code will then be inserted into the page:

C#  
<script runat="server">  
void Login1_LoginFailed(object sender, System.EventArgs e)  
{  
//code here     
}  
</script>  
 
VB  
<script runat="server">  
Sub Login1_LoginFailed(sender As Object, e As System.EventArgs)  
'code here  
End Sub  
</script>  

Modify this event procedure to contain the following code:


C#  
<script runat="server">  
void Login1_LoginFailed(object sender, System.EventArgs e)  
{  
this.lblLoginStatus.Text = "Login failed, Please check your details";  
this.lblLoginStatus.ForeColor = System.Drawing.Color.Red;        
}  
</script>  
 
VB  
<script runat="server">  
Sub Login1_LoginFailed(sender As Object, e As System.EventArgs)  
this.lblLoginStatus.Text = "Login failed, Please check your details"  
this.lblLoginStatus.ForeColor = System.Drawing.Color.Red     
End Sub  
</script>  


This will run when a customer login fails, what will happen is the first line will set the text of the lblLoginStatus to "Login failed, Please check your details" and the second line will make the labels ForeColor red drawing the customers attention to it quickly.


Next: Order Summery