Link does not print properly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sl1ver
    New Member
    • Mar 2009
    • 196

    Link does not print properly

    currently I have this text

    Code:
    sData +=    "<tr> \n" +
                                "<td> \n" +
                                "<a href=\"title.aspx?titleid= "+dr["inttitleId"].ToString() + ">" + dr["vcTitleName"].ToString() + "</a> \n" + " (" + dr["vcCertificate"].ToString() + ") " + dr["intyear"].ToString() + "<br /><br />\n" +
                                "Starring: " + dr["actor"].ToString() + "<br /><br />\n" +
                                "some text for testing purposes <br />\n" +
                                "</td> \n" +
                                "</tr> \n";
    Now if that link is not a link(when i remove the code) it prints fine and even with the link it prints fine.

    BUT it basically send me to the page with everything including all the text after the link even though I closed the a tag. What am I doing wrong?
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    When the page is displayed in the browser, right click on it and view the code. Look for the link... you've probably got invalid HTML in there somewhere.

    To avoid problems like this you should use ASP.NET controls like the GridView, or Repeater. You can add links, text, etc. into to these controls by binding to data in a "Data Source" that you provide to them.

    You do not have to generate HTML in your C# (or VB.NET) server-side code in ASP.NET



    -Frinny

    Comment

    • Sl1ver
      New Member
      • Mar 2009
      • 196

      #3
      Thanx for the advice, do you perhaps know of a good tutorial on how to use a repeater with paging capabilities?

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Check out the MSDN documentation on the Repeater class. There are walkthroughs in the article (scroll down past all of the properties, methods, and event documentation links to find them).

        -Frinny

        Comment

        • Sl1ver
          New Member
          • Mar 2009
          • 196

          #5
          Thanx, I have already implemented a repeater and it works so much better from a HTML point of view.

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Yeah they're pretty cool :)

            Comment

            Working...