The server tag is not well formed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am very new at all of this and am using a book to put together an
e-commerce website using VS.NET 2003. I have run into a problem and have
looked around the web but with no help. I am getting the following error
when I try to load my website.

Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.

Parser Error Message: The server tag is not well formed.

Source Error:

Line 6: <SelectedItemTemplate>
Line 7: »
Line 8: <asp:HyperLink id=HyperLink2 runat="server"
Line 9: NavigateUrl='<%# "../default.aspx?DepartmentID=" &
Line 10: DataBinder.Eval(Container.DataItem, "departmentID") &

If any one would like to check out the error my website's address is
http://surfnsun.gasner.com

Thanks very much in advance

Davey
 
It's not showing the error totally clearly (is that suppose to be &amp;
?) but...

try
<asp:HyperLink NavigateUrl="blah.asp?blah=<%#DataBinder%>" ...

I am assuming that your basic syntax is correct :
<SelectedItemTemplate>
<asp:Hyperlink runat="server" ... />
-or -
<asp:Hyperlink runat="server> ... </asp:hyperlink>
</SelectedItemTemplate>

Just make sure it's closed, or you can post the whole selected item
template code. I would also try without the <%..%> part first, in case
that is the problem.
 
Hi

You haven't posted the whole link so I think there is a problem with tag
ending. I tested the follwing code and it works properly.

Complete Code :

»<asp:HyperLink id=Hyprelink2 runat="server" NavigateUrl='<%#
"../default.aspx?DepartmentID=" & DataBinder.Eval(Container.DataItem,
"Departmentid") %>' >Your link text</asp:HyperLink>

regards,
Bhavesh Patel
 
Ok I'l do my best to put most of the code from the user control out here but
there is a problem and the &amp things dont show up as what they are supposed
to. Here is the entire code for the page witht the problems.

"<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="DepartmentList.ascx.vb"
Inherits="surfnsun.gasner.com.DepartmentList"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>"
<asp:DataList id="list" runat="server" CellPadding="0">
<HeaderTemplate>
<IMG alt="" src="Images/DeptHeader.gif" border="0">
</HeaderTemplate>
<SelectedItemTemplate>
&nbsp;»
<asp:HyperLink id=HyperLink2 runat="server"
NavigateUrl="'<%# "../default.aspx?DepartmentID=" &
DataBinder.Eval(Container.DataItem, "departmentID") &
"&DepartmentIndex=" & Container.ItemIndex %>'"
Text="'<%# DataBinder.Eval(Container.DataItem, "Name") %>'"
CssClass="DepartmentSelected">
</asp:HyperLink>
</SelectedItemTemplate>
<FooterTemplate>
<IMG alt="" src="Images/DeptFooter.gif" border="0">
</FooterTemplate>
<ItemStyle BackColor="Yellow"></ItemStyle>
<ItemTemplate>
»
<asp:HyperLink ID=HyperLink1 Runat="server"
NavigateUrl="'<%# "../default.aspx?DepartmentID=" &
DataBinder.Eval(Container.DataItem, "DepartmentID") &
"&DepartmentIndex=" & Conatiner.ItemIndex %>'"
Text="'<%# DataBinder.Eval(Container.DataItem, "Name") %>'"
CssClass="DepartmentUnselected">
</asp:HyperLink>
</ItemTemplate>
<HeaderStyle BackColor="Yellow"></HeaderStyle>
</asp:DataList>

Thank you very much for your help if you would like to see anything else
just tell me it is very much apprietiated.


Davey
 
Dear Friend

You have made a small mistake in Hyperlink formation.I parsed your code and
noted that you have set the Text and NavigateUrl property wrongly.

Just remove the double quote from the start and end of the each
property,your code will definately work.So the NavigateUrl and Text property
should be like

True Assignment:
NavigateUrl ='www.microsoft.com'
Text='Microsoft'

Wrong assignment:
NavigateUrl =" 'www.microsoft.com' "
Text=" 'Microsoft' "

Well there is not a problem with the "&" in your code.If you have still
problem than let me know I'll try to solve it.

Thanks,
Bhavesh Patel.
 
Back
Top