Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Mar 2006
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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">


    <aspataList 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")%>"><%#Container.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=795,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=795,height=650,top=10,left=40'); return false"><%#Container.DataItem("homepage_link_text")%></a></div>

    </asp:TableCell>

    </asp:TableRow>

    </asp:Table>

    </ItemTemplate>

    </aspataList>


    </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


    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=795,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.

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Quote Originally Posted by binici View Post

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

    title="<%#Container.DataItem("url_text")%>"

    should be
    title='<%#Container.DataItem("url_text")%>'

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    New Coder
    Join Date
    Mar 2006
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by nikkiH View Post
    Nested quotes.

    title="<%#Container.DataItem("url_text")%>"

    should be
    title='<%#Container.DataItem("url_text")%>'
    Thanks for the reply, I changed all the nested quotes with single quotes, but I still recieve the same error.

    ASPX:
    <aspataList 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")%>'><%#Container.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=795,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='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=795,height=650,top=10,left=40'); return false"><%#Container.DataItem("homepage_link_text")%></a></div>
    </asp:TableCell>
    </asp:TableRow>
    </asp:Table>
    </ItemTemplate>
    </aspataList>


    In the source code I tracked it down, looks like something is happening with the img src attribute tag? Doesn't like it?
    Source code:

    <tr>
    <td>
    <table id="QuickLinkItems__ctl0_table1" cellspacing="0" cellpadding="0" border="0" style="border-width:1px;border-style:solid;width:335px;border-collapse:collapse;">
    <tr>
    <td colspan="2"><a name='1' id="1'></a><br><span class="MainHead" title='Final Test!'>Final Test!</span></td>
    </tr><tr>
    <td id="QuickLinkItems__ctl0_image_cell" valign="top">
    <a class="HighlightMore" href="#" title='Final Test!' onclick="window.open('www.pwr.net','_PWRUpGuide','menubar=no,location=no,toolbar=no,status=no,scroll bars=yes,resizable=yes,width=795,height=650,top=10,left=40'); return false"><img src="Images/Thumbs/<%#Container.DataItem("image_name")%>" id="QuickLinkItems__ctl0_item_image" align="left" hspace="15" vspace="10" border="0" alt="Final Test!" /></a>
    </td><td valign="top" style="width:100%;"><br />
    Hello world!
    <br /><br />
    <div align="right"><A class="HighlightMore" href="#" title='>> Read More' onclick="window.open('www.pwr.net','_PWRUpGuide','menubar=no,location=no,toolbar=no,status=no,scroll bars=yes,resizable=yes,width=795,height=650,top=10,left=40'); return false">>> Read More</a></div>
    </td>
    </tr>
    </table>
    </td>
    </tr>

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Quote Originally Posted by nikkiH View Post
    Nested quotes.

    title="<%#Container.DataItem("url_text")%>"

    should be
    title='<%#Container.DataItem("url_text")%>'
    That's not nested quotes. That's server-side language (VB.NET, I believe) in the title attribute.

    binici, what error msg are you getting? Is it a server-side error or client-side error?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    New Coder
    Join Date
    Mar 2006
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by glenngv View Post
    That's not nested quotes. That's server-side language (VB.NET, I believe) in the title attribute.

    binici, what error msg are you getting? Is it a server-side error or client-side error?
    Ok, now I am not receiving an error, but the html is not formatted well.

    here is the aspx:

    <aspataList 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")%>'><%#Container.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=795,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='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=795,height=650,top=10,left=40'); return false"><%#Container.DataItem("homepage_link_text")%></a></div>
    </asp:TableCell>
    </asp:TableRow>
    </asp:Table>
    </ItemTemplate>
    </aspataList>

    When I view the page its screwed up and looks like this:

    http://www.pwr.net/homepage/error.jpg

    Please help!

  • #6
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Why are you even doing that, by the way?
    There are so many controls for this sort of thing. There is rarely a reason to use this syntax. If you're using Container DataItem, you're in a databound control. why not use Repeater / ItemTemplate etc?

    For me to make good suggestions to an alternative, I need to know if you're using 1.1 or 2.0. A lot of things changed with 2.0.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #7
    New Coder
    Join Date
    Mar 2006
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    Quote Originally Posted by nikkiH View Post
    Why are you even doing that, by the way?
    There are so many controls for this sort of thing. There is rarely a reason to use this syntax. If you're using Container DataItem, you're in a databound control. why not use Repeater / ItemTemplate etc?

    For me to make good suggestions to an alternative, I need to know if you're using 1.1 or 2.0. A lot of things changed with 2.0.

    I am using 2.0, I thought that the reapter and Datalist are similar?

    Anyways, I changed the code using the reapter control and same thing is happening

    <asp:Repeater ID="reapter1" runat="server" 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")%>'><%#Container.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=795,height=650,top=10,left=40'); return false"><img id="item_image" runat="server" src='Image/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=795,height=650,top=10,left=40'); return false"><%#Container.DataItem("homepage_link_text")%></a></div>
    </asp:TableCell>
    </asp:TableRow>
    </asp:Table>
    </ItemTemplate>
    </asp:Repeater>

    Did you take a look at the code source and the screen shot? It's like the

    <img id="item_image" runat="server" src='Image/Thumbs/<%#Container.DataItem("image_name")%>' align="left" hspace="15" vspace="10" alt='<%#Container.DataItem("url_text")%>' border="0">

    is breaking because of the "/" are used in the src attribute.

    Its frustrating

  • #8
    New Coder
    Join Date
    Mar 2006
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •