473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

What Is Going On Here?

I have run into a problem with one of my aspx pages. When I run the
page, I get a "Server Tag Is Not Well Formed" error. This message goes
away when I remove the line with the problem. This simply does not make
any sense. I have triple-checked everything. What am I doing wrong
here?

Below is a snippet of the "problem" line. After that is the entire aspx
page, with the "problem" line marked with HTML comment tags...

<asp:HyperLink id="Test" Target="_blank" Runat="server"
CssClass="One"
NavigateUrl="/Admin/MessageCenter/ShowMessage.aspx?Name=MessageID&Value=<%#
DataBinder.Eval(Container.DataItem, "Number") %>"><%#
DataBinder.Eval(Container.DataItem, "Subject") %></asp:HyperLink>

<%@ Register TagPrefix="TTVS" TagName="MAINHEADER"
Src="/MainHeader.ascx" %>
<%@ Register TagPrefix="TTVS" TagName="MAINFOOTER"
Src="/MainFooter.ascx" %>
<%@ Page language="c#" Codebehind="MessageCenter.aspx.cs"
AutoEventWireup="false" Inherits="TTVS.Admin_MessageCenter" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>System Administration</title>
<meta content="Microsoft Visual Studio .NET 7.1" 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">
<link href="/Base.css" type="text/css" rel="stylesheet">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<div class="Main">
<table class="Main">
<tr>
<td><TTVS:MAINHEADER id="MainHeader"
runat="server"></TTVS:MAINHEADER></td>
</tr>
<tr>
<td>
<asp:Label id="lblPageTitle" runat="server"
CssClass="Two"></asp:Label>
</td>
</tr>
<tr>
<td>
<table class="Expand">
<asp:Repeater id="rptMessageSummary" runat="server">
<ItemTemplate>
<tr>
<td width="40">
<asp:Label Runat="server" CssClass="Three">
<%# DataBinder.Eval(Container.DataItem, "Priority") %>
</asp:Label>
</td>
<td width="100">
<asp:Label Runat="server" CssClass="Three">
<%#
((DateTime)(DataBinder.Eval(Container.DataItem,"Da teTime"))).ToString("ddMMMyy
HH:mm:ss").ToUpper() %>
</asp:Label>
</td>
<td width="125">
<asp:Label Runat="server" CssClass="Three">
<%# DataBinder.Eval(Container.DataItem, "From") %>
</asp:Label>
</td>
<td width="535">

<!-- BELOW IS THE PROBLEM LINE -->
<asp:HyperLink id="Test" Target="_blank" Runat="server"
CssClass="One"
NavigateUrl="/Admin/MessageCenter/ShowMessage.aspx?Name=MessageID&Value=<%#
DataBinder.Eval(Container.DataItem, "Number") %>"><%#
DataBinder.Eval(Container.DataItem, "Subject") %></asp:HyperLink>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</td>
</tr>
<tr>
<td>
<TTVS:MAINFOOTER id="MainFooter"
runat="server"></TTVS:MAINFOOTER>
</td>
</tr>
</table>
</div>
</form>
</body>
</HTML>

Nov 19 '05 #1
4 1294
You can't do:
NavigateUrl="/Admin/MessageCenter/ShowMessage.aspx?Name=MessageID&Value=<%#
DataBinder.Eval(Container.DataItem, "Number") %>"

Instead you need to use: NavigateUrl='<%#
"/Admin/MessageCenter/ShowMessage.aspx?Name=MessageID&Value=" +
DataBinder.Eval(Container.DataItem, "Number") %>'

Besure you use the single quotes at the beginning and the end

-Will
Nov 19 '05 #2
That doesn't work. I tried that first before making the post. I also
tried a couple of other things.

I am pretty sure that Visual Studio does not like the <%#
DataBinder.Eval......%> block within the attributes portion of the
server tag element (it's only the first <#% .... %> that causes the
problem)...but why? How can I make it work?
Will wrote:
You can't do:
NavigateUrl="/Admin/MessageCenter/ShowMessage.aspx?Name=MessageID&Value=<%#
DataBinder.Eval(Container.DataItem, "Number") %>"

Instead you need to use: NavigateUrl='<%#
"/Admin/MessageCenter/ShowMessage.aspx?Name=MessageID&Value=" +
DataBinder.Eval(Container.DataItem, "Number") %>'

Besure you use the single quotes at the beginning and the end

-Will


Nov 19 '05 #3
Just use the itemdatabound event to define the hyperlink properties.
It is much easier.
Private Sub dg_ItemDataBound(ByVal sender As System.Object, ByVal e As
DataGridItemEventArgs) Handles dg.ItemDataBound
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType =
ListItemType.AlternatingItem Then

Dim oHylTest As HyperLink = CType(e.Item.FindControl("Test"),
HyperLink)
oHylTest .NavigateUrl
="/Admin/MessageCenter/ShowMessage.aspx?Name=MessageID&Value=" & number &
subject
oHylTest .Text = "code"

End If
End Sub

--
Joe Fallon

<jo*********@topscene.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
I have run into a problem with one of my aspx pages. When I run the
page, I get a "Server Tag Is Not Well Formed" error. This message goes
away when I remove the line with the problem. This simply does not make
any sense. I have triple-checked everything. What am I doing wrong
here?

Below is a snippet of the "problem" line. After that is the entire aspx
page, with the "problem" line marked with HTML comment tags...

<asp:HyperLink id="Test" Target="_blank" Runat="server"
CssClass="One"
NavigateUrl="/Admin/MessageCenter/ShowMessage.aspx?Name=MessageID&Value=<%#
DataBinder.Eval(Container.DataItem, "Number") %>"><%#
DataBinder.Eval(Container.DataItem, "Subject") %></asp:HyperLink>

<%@ Register TagPrefix="TTVS" TagName="MAINHEADER"
Src="/MainHeader.ascx" %>
<%@ Register TagPrefix="TTVS" TagName="MAINFOOTER"
Src="/MainFooter.ascx" %>
<%@ Page language="c#" Codebehind="MessageCenter.aspx.cs"
AutoEventWireup="false" Inherits="TTVS.Admin_MessageCenter" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>System Administration</title>
<meta content="Microsoft Visual Studio .NET 7.1" 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">
<link href="/Base.css" type="text/css" rel="stylesheet">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<div class="Main">
<table class="Main">
<tr>
<td><TTVS:MAINHEADER id="MainHeader"
runat="server"></TTVS:MAINHEADER></td>
</tr>
<tr>
<td>
<asp:Label id="lblPageTitle" runat="server"
CssClass="Two"></asp:Label>
</td>
</tr>
<tr>
<td>
<table class="Expand">
<asp:Repeater id="rptMessageSummary" runat="server">
<ItemTemplate>
<tr>
<td width="40">
<asp:Label Runat="server" CssClass="Three">
<%# DataBinder.Eval(Container.DataItem, "Priority") %>
</asp:Label>
</td>
<td width="100">
<asp:Label Runat="server" CssClass="Three">
<%#
((DateTime)(DataBinder.Eval(Container.DataItem,"Da teTime"))).ToString("ddMMMyy
HH:mm:ss").ToUpper() %>
</asp:Label>
</td>
<td width="125">
<asp:Label Runat="server" CssClass="Three">
<%# DataBinder.Eval(Container.DataItem, "From") %>
</asp:Label>
</td>
<td width="535">

<!-- BELOW IS THE PROBLEM LINE -->
<asp:HyperLink id="Test" Target="_blank" Runat="server"
CssClass="One"
NavigateUrl="/Admin/MessageCenter/ShowMessage.aspx?Name=MessageID&Value=<%#
DataBinder.Eval(Container.DataItem, "Number") %>"><%#
DataBinder.Eval(Container.DataItem, "Subject") %></asp:HyperLink>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</td>
</tr>
<tr>
<td>
<TTVS:MAINFOOTER id="MainFooter"
runat="server"></TTVS:MAINFOOTER>
</td>
</tr>
</table>
</div>
</form>
</body>
</HTML>

Nov 19 '05 #4
On Wed, 13 Jul 2005 17:58:26 -0500, <jo*********@topscene.com> wrote:
That doesn't work. I tried that first before making the post. I also
tried a couple of other things.

I am pretty sure that Visual Studio does not like the <%#
DataBinder.Eval......%> block within the attributes portion of the
server tag element (it's only the first <#% .... %> that causes the
problem)...but why? How can I make it work?

Instead you need to use: NavigateUrl='<%#
"/Admin/MessageCenter/ShowMessage.aspx?Name=MessageID&Value=" +
DataBinder.Eval(Container.DataItem, "Number") %>'

Besure you use the single quotes at the beginning and the end

-Will


I think you want to move your second <%# %> in as the value of the Text
attribute for the hyperlink, not as the innertext of the hyperlink node.

<asp:hyperlink navigateurl='<%# ... %>' text='<%# ... %>'

And do similar to Will's example with making the whole attribute value a
binding expression, and proper use of quotes.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

52
by: Tony Marston | last post by:
Several months ago I started a thread with the title "What is/is not considered to be good OO programming" which started a long and interesting discussion. I have condensed the arguments into a...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
9
by: andrew | last post by:
Hi, I posted this message recently, but received no response, so I figured I'd try again. I can't find anybody who can tell me what's going on here. I'm having a problem with fieldsets in IE...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
8
by: Midnight Java Junkie | last post by:
Dear Colleagues: I feel that the dumbest questions are those that are never asked. I have been given the opportunity to get into .NET. Our organization has a subscription with Microsoft that...
63
by: Jake Barnes | last post by:
In the course of my research I stumbled upon this article by Alex Russel and Tim Scarfe: http://www.developer-x.com/content/innerhtml/default.html The case is made that innerHTML should never...
18
by: ben.carbery | last post by:
Hi, I have just written a simple program to get me started in C that calculates the number of days since your birthdate. One thing that confuses me about the program (even though it works) is...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
6
by: LurfysMa | last post by:
I am working on an electronic flashcard application. I have one version up and running using Visual Basic (6.0) and Access 2000. My long-range plans are to put it up on a website and sell...
10
by: JoeC | last post by:
I have been programming for a while and I have seen this syntax before and I copied this from a book but the book didn't explain what is going on here. class engine{ protected: static engine*...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.