Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. display hyperlink

display hyperlink

Scheduled Pinned Locked Moved ASP.NET
comdesignhelp
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aljaz111
    wrote on last edited by
    #1

    I created div like this: System.Web.UI.HtmlControls.HtmlGenericControl dynDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV"); And hyperlink like this: System.Web.UI.WebControls.HyperLink link = new System.Web.UI.WebControls.HyperLink(); link.NavigateUrl = "http://blabla.com"; link.Text = "Click here"; link.Target = "_blank"; Now I am trying to display this link in div that i could click on it. When I add link to div like this: dynDiv.InnerHtml= link; It doesn't work. Help plz.

    S 1 Reply Last reply
    0
    • A Aljaz111

      I created div like this: System.Web.UI.HtmlControls.HtmlGenericControl dynDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV"); And hyperlink like this: System.Web.UI.WebControls.HyperLink link = new System.Web.UI.WebControls.HyperLink(); link.NavigateUrl = "http://blabla.com"; link.Text = "Click here"; link.Target = "_blank"; Now I am trying to display this link in div that i could click on it. When I add link to div like this: dynDiv.InnerHtml= link; It doesn't work. Help plz.

      S Offline
      S Offline
      Sandeep Mewara
      wrote on last edited by
      #2

      What doesn't work? Where is the code to place the DIV in your UI? You need to add DIV dynamic control to some container such that it is visible. Once the Div is visible, all the contents present in it will be visible. Add controls to div and then add div to some container.

      A 1 Reply Last reply
      0
      • S Sandeep Mewara

        What doesn't work? Where is the code to place the DIV in your UI? You need to add DIV dynamic control to some container such that it is visible. Once the Div is visible, all the contents present in it will be visible. Add controls to div and then add div to some container.

        A Offline
        A Offline
        Aljaz111
        wrote on last edited by
        #3

        I added it to my module like this: this.Controls.Add(dynDiv); And like i wrote before when i add innerhtml i get for link this output: System.Web.UI.WebControls.HyperLink

        S 1 Reply Last reply
        0
        • A Aljaz111

          I added it to my module like this: this.Controls.Add(dynDiv); And like i wrote before when i add innerhtml i get for link this output: System.Web.UI.WebControls.HyperLink

          S Offline
          S Offline
          Sandeep Mewara
          wrote on last edited by
          #4

          Which line of my answer you were able to got? Adding a div to any container: You did: this.Controls.Add(dynDiv); totally WRONG Where is the container to which you added it? It would be something like if you have a panel in the page: Panel1.Controls.Add(dynDiv); Adding controls to the div: You did: dynDiv.InnerHtml= link; again WRONG Is this the add the controls? It would be: dynDiv.Controls.Add(link); You are done! I would suggest you to pick a book please. Read it. It will help improving fast.

          A 1 Reply Last reply
          0
          • S Sandeep Mewara

            Which line of my answer you were able to got? Adding a div to any container: You did: this.Controls.Add(dynDiv); totally WRONG Where is the container to which you added it? It would be something like if you have a panel in the page: Panel1.Controls.Add(dynDiv); Adding controls to the div: You did: dynDiv.InnerHtml= link; again WRONG Is this the add the controls? It would be: dynDiv.Controls.Add(link); You are done! I would suggest you to pick a book please. Read it. It will help improving fast.

            A Offline
            A Offline
            Aljaz111
            wrote on last edited by
            #5

            If i add link as control to Panel, it works, but all the links are shown at the bottom. If i add links to div, i get error at page load. I have one div. Is it possible to show few hyperlinks at random places in div? For example i am getting some info and i am adding info in single div with div.Innerhtml+=info How could i add hyperlink at the end of one part of info? Hope you understand what i am trying to do.

            P 1 Reply Last reply
            0
            • A Aljaz111

              If i add link as control to Panel, it works, but all the links are shown at the bottom. If i add links to div, i get error at page load. I have one div. Is it possible to show few hyperlinks at random places in div? For example i am getting some info and i am adding info in single div with div.Innerhtml+=info How could i add hyperlink at the end of one part of info? Hope you understand what i am trying to do.

              P Offline
              P Offline
              PunkIsNotDead
              wrote on last edited by
              #6

              instead use Panel1.Controls.Add(MyDiv); try using Panel1.Controls.AddAt(0, MyDiv); Where 0 is the position of the controls! ;)

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups