By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,947 Members | 1,594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,947 IT Pros & Developers. It's quick & easy.

Unexpected end of file looking for </HeaderTemplate>

P: n/a
CJM
I've copied (& modified) some code from MSDN which uses a Repeater control,
but I'm getting an error: Unexpected end of file looking for
</HeaderTemplate>

As far as I can see I've not made an dramatic changes, and if the MSDN code
would work, I would also expect mine to work.

As far as the </HeaderTemplate> tag is concerned, I removed it and replaced
it - but it did not appear in the Intellisense list.

I've included both the html & code snippets below.

Any help would be appreciated.

Chris

Snippets:

<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>&nbsp;</td>
<td><asp:Button ID="cmdSearch" Text="Search" Runat="server" /></td>
</tr>
</table>

<asp:Repeater id=rpResults runat="server">
<HeaderTemplate>
<table id="tblResults" class="tbl centered" cellspacing="0"
runat="server">
<tr>
<th>TA Number:</th>
<th><%# DataBinder.Eval(Container, "DataItem.TANumber") %></th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>PO Number:</td>
<td><%# DataBinder.Eval(Container, "DataItem.PONumber") %></td>
</tr>
<tr>
<td>PO Line:</td>
<td><%# DataBinder.Eval(Container, "DataItem.POLine") %></td>
</tr>
<tr>
<td>Part No:</td>
<td><%# DataBinder.Eval(Container, "DataItem.PartNumber") %></td>
</tr>
<tr>
<td>Part XRef:</td>
<td><%# DataBinder.Eval(Container, "DataItem.PartXref") %></td>
</tr>
<tr>
<td>Description:</td>
<td><%# DataBinder.Eval(Container, "DataItem.DescText") %></td>
</tr>
<tr>
<td>Quantity Rec'd:</td>
<td><%# DataBinder.Eval(Container, "DataItem.QuantityRecd") %></td>
</tr>
<tr>
<td>Advice Note:</td>
<td><%# DataBinder.Eval(Container, "DataItem.AdviceNote") %></td>
</tr>
<tr>
<td>Supplier ID:</td>
<td><%# DataBinder.Eval(Container, "DataItem.SupplierID") %></td>
</tr>
<tr>
<td>Cert/Cast No:</td>
<td><%# DataBinder.Eval(Container, "DataItem.CastNo") %></td>
</tr>
<tr>
<td>Date Rec'd:</td>
<td><%# DataBinder.Eval(Container, "DataItem.DateRecd") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>

Public Class viewta2
Inherits System.Web.UI.Page

Protected WithEvents tblRequest As HtmlTable
Protected WithEvents tblResults As HtmlTable
Protected WithEvents cmdSearch As System.Web.UI.WebControls.Button
Protected WithEvents rpResults As System.Web.UI.WebControls.Repeater
Protected WithEvents txtTANumber As TextBox
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

Dim oConn As SqlConnection
Dim oCmd As SqlCommand
Dim dtrTADetails As SqlDataReader

If IsPostBack Then
'Hide Search button
tblResults.Visible = True
tblRequest.Visible = False

oConn = New SqlConnection(Application("DB"))
oCmd = New SqlCommand("Exec TA_GetTADetails " & txtTANumber.Text, oConn)
oConn.Open()

With rpResults
.DataSource = oCmd.ExecuteReader()
.DataBind()

End With

oConn.Close()
Else
'Hide(results)
tblResults.Visible = False
tblRequest.Visible = True
End If

End Sub

End Class

Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Your controls aren't closing in the same order you are opening them

<headerTemplate>
<table runat="server">...
</headerTEmplate>

You need to either close the </table> inside the headerTemplate or remove
the runat="Server"

Karl

"CJM" <cj*******@newsgroups.nospam> wrote in message
news:eT**************@TK2MSFTNGP09.phx.gbl...
I've copied (& modified) some code from MSDN which uses a Repeater control, but I'm getting an error: Unexpected end of file looking for
</HeaderTemplate>

As far as I can see I've not made an dramatic changes, and if the MSDN code would work, I would also expect mine to work.

As far as the </HeaderTemplate> tag is concerned, I removed it and replaced it - but it did not appear in the Intellisense list.

I've included both the html & code snippets below.

Any help would be appreciated.

Chris

Snippets:

<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>&nbsp;</td>
<td><asp:Button ID="cmdSearch" Text="Search" Runat="server" /></td>
</tr>
</table>

<asp:Repeater id=rpResults runat="server">
<HeaderTemplate>
<table id="tblResults" class="tbl centered" cellspacing="0"
runat="server">
<tr>
<th>TA Number:</th>
<th><%# DataBinder.Eval(Container, "DataItem.TANumber") %></th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>PO Number:</td>
<td><%# DataBinder.Eval(Container, "DataItem.PONumber") %></td>
</tr>
<tr>
<td>PO Line:</td>
<td><%# DataBinder.Eval(Container, "DataItem.POLine") %></td>
</tr>
<tr>
<td>Part No:</td>
<td><%# DataBinder.Eval(Container, "DataItem.PartNumber") %></td>
</tr>
<tr>
<td>Part XRef:</td>
<td><%# DataBinder.Eval(Container, "DataItem.PartXref") %></td>
</tr>
<tr>
<td>Description:</td>
<td><%# DataBinder.Eval(Container, "DataItem.DescText") %></td>
</tr>
<tr>
<td>Quantity Rec'd:</td>
<td><%# DataBinder.Eval(Container, "DataItem.QuantityRecd") %></td>
</tr>
<tr>
<td>Advice Note:</td>
<td><%# DataBinder.Eval(Container, "DataItem.AdviceNote") %></td>
</tr>
<tr>
<td>Supplier ID:</td>
<td><%# DataBinder.Eval(Container, "DataItem.SupplierID") %></td>
</tr>
<tr>
<td>Cert/Cast No:</td>
<td><%# DataBinder.Eval(Container, "DataItem.CastNo") %></td>
</tr>
<tr>
<td>Date Rec'd:</td>
<td><%# DataBinder.Eval(Container, "DataItem.DateRecd") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>

Public Class viewta2
Inherits System.Web.UI.Page

Protected WithEvents tblRequest As HtmlTable
Protected WithEvents tblResults As HtmlTable
Protected WithEvents cmdSearch As System.Web.UI.WebControls.Button
Protected WithEvents rpResults As System.Web.UI.WebControls.Repeater
Protected WithEvents txtTANumber As TextBox
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

Dim oConn As SqlConnection
Dim oCmd As SqlCommand
Dim dtrTADetails As SqlDataReader

If IsPostBack Then
'Hide Search button
tblResults.Visible = True
tblRequest.Visible = False

oConn = New SqlConnection(Application("DB"))
oCmd = New SqlCommand("Exec TA_GetTADetails " & txtTANumber.Text, oConn) oConn.Open()

With rpResults
.DataSource = oCmd.ExecuteReader()
.DataBind()

End With

oConn.Close()
Else
'Hide(results)
tblResults.Visible = False
tblRequest.Visible = True
End If

End Sub

End Class


Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.