Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 15th, 2007, 01:40 PM
Authorized User
 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default The server tag is not well formed.

I have a DataList and assigning the objects accordingly. I am also using the Event ItemDataBound to hide/show a control if there is data. Not sure why I am receiving this error?

 ASPX:

<body topmargin="0" leftmargin="10" rightmargin="10" bgcolor="ffffff">

<table width="335" cellSpacing="0" cellPadding="0" border="0">

<tr>

<td align="left">


<asp:DataList ID="QuickLinkItems" runat="server" BorderWidth="0px" CellPadding="0" DataSourceID="SqlDataSource1">

<ItemTemplate>

<asp:Table ID="table1" runat="server" Width="335" CellPadding="0" CellSpacing="0" BorderWidth="1">

<asp:TableRow>

<asp:TableCell ColumnSpan="2"><a name="<%#Container.DataItem("orderby")%>" id="<%#Container.DataItem("orderby")%>"></a><br><span class="MainHead" title="<%#Container.DataItem("url_text")%>"><%#Con tainer.DataItem("url_text")%></span></asp:TableCell>

</asp:TableRow>

<asp:TableRow>

<asp:TableCell ID="image_cell" runat="server" VerticalAlign="Top">

<a class="HighlightMore" href="#" title="<%#Container.DataItem("url_text")%>" onclick="window.open('<%#Container.DataItem("url") %>','_PWRUpGuide','menubar=no,location=no,toolbar= no,status=no,scrollbars=yes,resizable=yes,width=79 5,height=650,top=10,left=40'); return false"><img id="item_image" runat="server" src="/homepage/Images/Thumbs/<%#Container.DataItem("image_name")%>" align="left" hspace="15" vspace="10" alt="<%#Container.DataItem("url_text")%>" border="0"></a>

</asp:TableCell>

<asp:TableCell VerticalAlign="Top" Width="100%"><br />

<%#Container.DataItem("description")%>

<br /><br />

<div align="right"><A class="HighlightMore" href="#" title="<%#Container.DataItem("homepage_link_text") %>" onclick="window.open('<%#Container.DataItem("url") %>','_PWRUpGuide','menubar=no,location=no,toolbar= no,status=no,scrollbars=yes,resizable=yes,width=79 5,height=650,top=10,left=40'); return false"><%#Container.DataItem("homepage_link_text") %></a></div>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

</ItemTemplate>

</asp:DataList>


</td>

</tr>

<tr>

<td height="275" colspan="2">&nbsp;

</td>

</tr>

</table>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ connectionStrings:connectionstring %>" ProviderName="System.Data.SqlClient" SelectCommand="SELECT url_text, url, orderby, homepage_link_text, description, image_name FROM tFeedArticles WHERE homepage_link_yn = 1 ORDER BY orderby" SelectCommandType="Text"></asp:SqlDataSource>

</body>

</html>



Codebehind:



Protected Sub QuickLinkItems_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles QuickLinkItems.ItemDataBound

Trace.IsEnabled = True

Trace.Warn("QuickLinkItems items", e.Item.FindControl("image_cell").ID)

Dim TableRow As TableCell = CType(e.Item.FindControl("image_cell"), TableCell)

Dim ItemImage As HtmlImage = CType(e.Item.FindControl("item_image"), HtmlImage)

If ItemImage.Src = "" Then

TableRow.Visible = False

Else

TableRow.Visible = True

End If

Trace.Warn("ItemImage", ItemImage.Src)

End Sub




 
Old May 15th, 2007, 01:43 PM
Authorized User
 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh btw, the error is being thrown here

Line 82: <a class="HighlightMore" href="#" title="<%#Container.DataItem("url_text")%>" onclick="window.open('<%#Container.DataItem("url") %>','_PWRUpGuide','menubar=no,location=no,toolbar= no,status=no,scrollbars=yes,resizable=yes,width=79 5,height=650,top=10,left=40'); return false"><img id="item_image" runat="server" src="/homepage/Images/Thumbs/<%#Eval("image_name")%>" align="left" hspace="15" vspace="10" alt="<%#Container.DataItem("url_text")%>" border="0"></a>

I checked my double quotes and tags to make sure they were correct.


 
Old May 15th, 2007, 01:46 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

I see a couple of double quotes inside the javascripts, are there ok???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old May 15th, 2007, 01:51 PM
Authorized User
 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by gbianchi
 I see a couple of double quotes inside the javascripts, are there ok???

HTH

Gonzalo

That seems to be fine, it's only when I remove the src= attribute it works normally with the logic.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old May 15th, 2007, 02:14 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

try adding ~ in front of the /homepage/Images/Thumbs/
Code:
src="~/homepage/Images/Thumbs/<%#Eval("image_name")%>"
that will tell the compiler to start looking that path in the root of your site...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old May 15th, 2007, 04:02 PM
Authorized User
 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by gbianchi
 try adding ~ in front of the /homepage/Images/Thumbs/
Code:
src="~/homepage/Images/Thumbs/<%#Eval("image_name")%>"
that will tell the compiler to start looking that path in the root of your site...

HTH

Gonzalo

I changed the code a bit, but now the page loads fine, but with no images.

<asp:DataList ID="QuickLinkItems" runat="server" BorderWidth="0px" CellPadding="0" DataSourceID="SqlDataSource1">
            <ItemTemplate>
                <asp:Table ID="table1" runat="server" Width="335" CellPadding="0" CellSpacing="0" BorderWidth="1">
                    <asp:TableRow>
                        <asp:TableCell ColumnSpan="2"><a name='<%#Container.DataItem("orderby")%>' id='<%#Container.DataItem("orderby")%>'></a><br><span class="MainHead" title='<%#Container.DataItem("url_text")%>'><%#Con tainer.DataItem("url_text")%></span></asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell ID="image_cell" runat="server" VerticalAlign="Top">
                            <a class="HighlightMore" href="#" title='<%#Container.DataItem("url_text")%>' onclick="window.open('<%#Container.DataItem("url") %>','_PWRUpGuide','menubar=no,location=no,toolbar= no,status=no,scrollbars=yes,resizable=yes,width=79 5,height=650,top=10,left=40'); return false"><img id="item_image" runat="server" align="left" hspace="15" vspace="10" alt='<%#Container.DataItem("url_text")%>' border="0" src="~/homepage/Images/Thumbs/<%#Container.DataItem("image_name")%>" /></a>
                        </asp:TableCell>
                        <asp:TableCell VerticalAlign="Top" Width="100%"><br />
                        <%#Container.DataItem("description")%>
                        <br /><br />
                        <div align="right"><A class="HighlightMore" href="#" title='<%#Container.DataItem("homepage_link_text") %>' onclick="window.open('<%#Container.DataItem("url") %>','_PWRUpGuide','menubar=no,location=no,toolbar= no,status=no,scrollbars=yes,resizable=yes,width=79 5,height=650,top=10,left=40'); return false"><%#Container.DataItem("homepage_link_text") %></a></div>
                        </asp:TableCell>
                    </asp:TableRow>
                </asp:Table>
            </ItemTemplate>
        </asp:DataList>

This is frustrating...

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old May 15th, 2007, 04:41 PM
Authorized User
 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Fixed:

I used the ItemDataBound event and manipulate the img tag with the path name as a string and pull the data from the datasource, which is the image name and write it out! Works like a charm!

Thank you,

Robert






Similar Threads
Thread Thread Starter Forum Replies Last Post
Unknown Server Tag sharon5469 ASP.NET 1.0 and 1.1 Basics 3 June 18th, 2008 03:03 PM
"The server tag is not well formed" Newbie... daveyboy ASP.NET 1.0 and 1.1 Basics 5 June 6th, 2008 10:54 AM
XML That Is Not Well Formed rvanandel Ajax 3 July 2nd, 2007 11:46 AM
Well formed HTML dkb XSLT 1 October 27th, 2003 01:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.