C
CJM
I'm finally taking my first few steps with ASP.NET, and I'm just workign my
way through some of the basics.
As a vehicle for my learning, I'm re-writing a simple report page for on of
my ASP applications.
I have two tables on this page. One is where the user requests a report for
a given ID number, the second is the table of result. Obviously I dont want
to show the results table until the query has been submitted, so I'm trying
to hide the table until IsPostBack = True.
As I understand it, I must declare the page controls, e.g. my tables, before
I can manipulate them in the CodeBehind page. I've done this but clearly I
am missing something because I am getting this error: BC30002: Type 'Table'
is not defined.
Thanks in advance
Chris
Code Snippets:
viewta.2aspx.vb:
Public Class viewta2
Inherits System.Web.UI.Page
Protected WithEvents tblResults As Table
Protected WithEvents tblRequest As Table
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If IsPostBack Then
'Hide Search button
tblResults.Visible = True
tblRequest.Visible = False
Else
'Hide(results)
tblResults.Visible = False
tblRequest.Visible = True
End If
End Sub
End Class
viewta2.aspx:
<%@ Page Inherits="viewta2" src="viewta2.aspx.vb" %>
<script runat="server">
Sub Page_Load
If Not IsPostBack Then
lblTANumber.visible=false
End If
End Sub
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>viewta2</title>
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="TADB.css" type="text/css">
</head>
<body MS_POSITIONING="GridLayout">
<form id="frmReport" method="post" runat="server">
<table id="tblRequest" class="tbl centered" cellspacing="0"
runat="server">
<tr>
<th colspan="2">View TA Details</th>
</tr>
<tr>
<td>TA Number:</td>
<td><asp:TextBox ID="txtTANumber" MaxLength="10" Runat="server"/></td>
</tr>
<tr>
<td> </td>
<td><asp:Button ID="cmdSearch" Text="Search" Runat="server"/></td>
</tr>
</table>
<table id="tblResults" class="tbl centered" cellspacing="0"
runat="server">
<tr>
<th>TA Number:</th>
<th><asp:Label ID="lblTANumber" Width="10" Runat="server"/></th>
</tr>
<tr>
<td>PO Number:</td>
<td><asp:Label ID="lblPONumber" Runat="server"/></td>
</tr>
<tr>
<td>PO Line:</td>
<td><asp:Label ID="lblPOLine" Runat="server"/></td>
</tr>
<tr>
<td>Part No:</td>
<td><asp:Label ID="lblPartNo" Runat="server"/></td>
</tr>
<tr>
<td>Part XRef:</td>
<td><asp:Label ID="lblPartXRef" Runat="server"/></td>
</tr>
<tr>
<td>Description:</td>
<td><asp:Label ID="lblDescText" Runat="server"/></td>
</tr>
<tr>
<td>Quantity Rec'd:</td>
<td><asp:Label ID="lblQuantityRecd" Runat="server"/></td>
</tr>
<tr>
<td>Advice Note:</td>
<td><asp:Label ID="lblAdviceNote" Runat="server"/></td>
</tr>
<tr>
<td>Supplier ID:</td>
<td><asp:Label ID="lblSuppierID" Runat="server"/></td>
</tr>
<tr>
<td>Cert/Cast No:</td>
<td><asp:Label ID="lblCastNo" Runat="server"/></td>
</tr>
<tr>
<td>Date Rec'd:</td>
<td><asp:Label ID="lblDateRecd" Runat="server"/></td>
</tr>
</table>
</form>
</body>
</html>
way through some of the basics.
As a vehicle for my learning, I'm re-writing a simple report page for on of
my ASP applications.
I have two tables on this page. One is where the user requests a report for
a given ID number, the second is the table of result. Obviously I dont want
to show the results table until the query has been submitted, so I'm trying
to hide the table until IsPostBack = True.
As I understand it, I must declare the page controls, e.g. my tables, before
I can manipulate them in the CodeBehind page. I've done this but clearly I
am missing something because I am getting this error: BC30002: Type 'Table'
is not defined.
Thanks in advance
Chris
Code Snippets:
viewta.2aspx.vb:
Public Class viewta2
Inherits System.Web.UI.Page
Protected WithEvents tblResults As Table
Protected WithEvents tblRequest As Table
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If IsPostBack Then
'Hide Search button
tblResults.Visible = True
tblRequest.Visible = False
Else
'Hide(results)
tblResults.Visible = False
tblRequest.Visible = True
End If
End Sub
End Class
viewta2.aspx:
<%@ Page Inherits="viewta2" src="viewta2.aspx.vb" %>
<script runat="server">
Sub Page_Load
If Not IsPostBack Then
lblTANumber.visible=false
End If
End Sub
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>viewta2</title>
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="TADB.css" type="text/css">
</head>
<body MS_POSITIONING="GridLayout">
<form id="frmReport" method="post" runat="server">
<table id="tblRequest" class="tbl centered" cellspacing="0"
runat="server">
<tr>
<th colspan="2">View TA Details</th>
</tr>
<tr>
<td>TA Number:</td>
<td><asp:TextBox ID="txtTANumber" MaxLength="10" Runat="server"/></td>
</tr>
<tr>
<td> </td>
<td><asp:Button ID="cmdSearch" Text="Search" Runat="server"/></td>
</tr>
</table>
<table id="tblResults" class="tbl centered" cellspacing="0"
runat="server">
<tr>
<th>TA Number:</th>
<th><asp:Label ID="lblTANumber" Width="10" Runat="server"/></th>
</tr>
<tr>
<td>PO Number:</td>
<td><asp:Label ID="lblPONumber" Runat="server"/></td>
</tr>
<tr>
<td>PO Line:</td>
<td><asp:Label ID="lblPOLine" Runat="server"/></td>
</tr>
<tr>
<td>Part No:</td>
<td><asp:Label ID="lblPartNo" Runat="server"/></td>
</tr>
<tr>
<td>Part XRef:</td>
<td><asp:Label ID="lblPartXRef" Runat="server"/></td>
</tr>
<tr>
<td>Description:</td>
<td><asp:Label ID="lblDescText" Runat="server"/></td>
</tr>
<tr>
<td>Quantity Rec'd:</td>
<td><asp:Label ID="lblQuantityRecd" Runat="server"/></td>
</tr>
<tr>
<td>Advice Note:</td>
<td><asp:Label ID="lblAdviceNote" Runat="server"/></td>
</tr>
<tr>
<td>Supplier ID:</td>
<td><asp:Label ID="lblSuppierID" Runat="server"/></td>
</tr>
<tr>
<td>Cert/Cast No:</td>
<td><asp:Label ID="lblCastNo" Runat="server"/></td>
</tr>
<tr>
<td>Date Rec'd:</td>
<td><asp:Label ID="lblDateRecd" Runat="server"/></td>
</tr>
</table>
</form>
</body>
</html>