ASP.NET

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentASP.NET

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old March 7th, 2012, 05:28 PM
aspnoob aspnoob is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Mar 2012
Posts: 1 aspnoob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 12 sec
Reputation Power: 0
VS Error

The line shown at the bottom in the VB source file is not working, I have no real experience with ASP.NET so this is really foreign to me. Help would great.
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="CustomerDisplay" %>

<!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>SportsPro</title>
    <style type="text/css">
        .style1
        {
            font-size: xx-large;
        }
        .style2
        {
            font-size: large;
        }
        .style3
        {
            width: 105px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <span style="color: blue; font-family: Arial" class="style1"><strong><em>SportsPro</em></strong></span><br />
        <span style="color: red" class="style2">Sports management software for the sports
            enthusiast</span><br />
        <br />
        Select a customer:&nbsp;
        <asp:DropDownList ID="ddlCustomers" runat="server" AutoPostBack="True" 
            DataSourceID="AccessDataSource1" DataTextField="Name" 
            DataValueField="CustomerID">
        </asp:DropDownList>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            DataFile="~/App_Data/TechSupport.mdb" 
            SelectCommand="SELECT [CustomerID], [Name], [Address], [City], [State], [ZipCode], [Email], [Phone] FROM [Customers] ORDER BY [Name]">
        </asp:AccessDataSource>
        <br />
        <br />
        <table>
            <tr>
                <td style="width: 72px">
                    Address:</td>
                <td class="style3">
                    <asp:Label ID="lblAddress" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td style="width: 72px">
                    </td>
                <td class="style3">
                    <asp:Label ID="lblCityStateZip" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td style="width: 72px">
                    Phone:</td>
                <td class="style3">
                    <asp:Label ID="lblPhone" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td style="width: 72px">
                    Email:</td>
                <td class="style3">
                    <asp:Label ID="lblEmail" runat="server"></asp:Label></td>
            </tr>
        </table>
        <br />
        <asp:Button ID="btnAdd" runat="server" Text="Add to Contact List" Width="144px" />&nbsp;
        <asp:Button ID="btnDisplay" runat="server" Text="Display Contact List"
            Width="144px" /><br />
        <asp:Label ID="lblErrorMessage" runat="server" ForeColor="Red"></asp:Label></div>
    </form>
</body>
</html>

Code:
Imports System.Data

Partial Class CustomerDisplay
    Inherits System.Web.UI.Page

    Private SelectedCustomer As Customer

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles Me.Load
        If IsPostBack Then
            ddlCustomers.DataBind()
        End If
        SelectedCustomer = Me.GetSelectedCustomer
        Me.DisplayCustomer()
        lblErrorMessage.Text = ""
    End Sub

    Private Function GetSelectedCustomer() As Customer
        Dim dvTable As DataView = CType(AccessDataSource1.Select( _
            DataSourceSelectArguments.Empty), DataView)
        
dvTable.RowFilter = "CustomerID = " & ddlCustomers.SelectedValue Code:
Original - dvTable.RowFilter = "CustomerID = " & ddlCustomers.SelectedValue Code
    dvTable.RowFilter = "CustomerID = " & ddlCustomers.SelectedValue
Dim drvRow As DataRowView = dvTable(0) Dim customer As New Customer customer.CustomerID = CInt(drvRow("CustomerID")) customer.Name = drvRow("Name").ToString customer.Address = drvRow("Address").ToString customer.City = drvRow("City").ToString customer.State = drvRow("State").ToString customer.ZipCode = drvRow("ZipCode").ToString customer.Phone = drvRow("Phone").ToString customer.Email = drvRow("Email").ToString Return customer End Function Private Sub DisplayCustomer() lblAddress.Text = SelectedCustomer.Address lblCityStateZip.Text = SelectedCustomer.City & ", " _ & SelectedCustomer.State & " " _ & SelectedCustomer.ZipCode lblPhone.Text = SelectedCustomer.Phone lblEmail.Text = SelectedCustomer.Email End Sub Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles btnAdd.Click 'Store customers that are added to the contact list in a sorted list whose key is CustomerID Dim ContactList As SortedList = Me.GetContactList Dim iCustomerID As Integer = SelectedCustomer.CustomerID If Not ContactList.ContainsKey(iCustomerID) Then ContactList.Add(iCustomerID, SelectedCustomer) 're-directs to contacts.aspx Response.Redirect("CustomerDisplay.aspx") Else lblErrorMessage.Text = "This customer is already in the contact list." End If End Sub Private Function GetContactList() As SortedList If Session("ContactList") Is Nothing Then Session.Add("ContactList", New SortedList) End If Return CType(Session("ContactList"), SortedList) End Function Protected Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click End Sub End Class

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentASP.NET > VS Error


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap