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. Why this ont rendering the Control properly

Why this ont rendering the Control properly

Scheduled Pinned Locked Moved ASP.NET
question
9 Posts 2 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.
  • D Offline
    D Offline
    danasegaranea
    wrote on last edited by
    #1

    I tried to create one LinkButton. Used this code.

    Dim hlink As LinkButton
    Dim sw As System.IO.StringWriter
    Dim htw As HtmlTextWriter
    hlink = New LinkButton
    hlink.ID = "ZoneLink"
    hlink.Text = "TestButton"
    sw = New System.IO.StringWriter
    htw = New HtmlTextWriter(sw)
    hlink.PostBackUrl = "Default2.aspx"
    hlink.RenderControl(htw)
    Response.Write(sw.ToString)

    But only displays the text. No hyperlink is displayed ?

    D 1 Reply Last reply
    0
    • D danasegaranea

      I tried to create one LinkButton. Used this code.

      Dim hlink As LinkButton
      Dim sw As System.IO.StringWriter
      Dim htw As HtmlTextWriter
      hlink = New LinkButton
      hlink.ID = "ZoneLink"
      hlink.Text = "TestButton"
      sw = New System.IO.StringWriter
      htw = New HtmlTextWriter(sw)
      hlink.PostBackUrl = "Default2.aspx"
      hlink.RenderControl(htw)
      Response.Write(sw.ToString)

      But only displays the text. No hyperlink is displayed ?

      D Offline
      D Offline
      darkcalin
      wrote on last edited by
      #2

      Use this code (is in c#): Literal lit = new Literal(); lit.Text = @"<a href=""Default2.aspx"">TestButton</a>"; lit.RenderControl(htw); Response.Write(sw.ToString());

      D 1 Reply Last reply
      0
      • D darkcalin

        Use this code (is in c#): Literal lit = new Literal(); lit.Text = @"<a href=""Default2.aspx"">TestButton</a>"; lit.RenderControl(htw); Response.Write(sw.ToString());

        D Offline
        D Offline
        danasegaranea
        wrote on last edited by
        #3

        This method is not causing the postback event.

        D 1 Reply Last reply
        0
        • D danasegaranea

          This method is not causing the postback event.

          D Offline
          D Offline
          darkcalin
          wrote on last edited by
          #4

          Ok then try this: LinkButton hlink = new LinkButton(); hlink.ID = "ZoneLink"; hlink.Text = "TestButton"; hlink.PostBackUrl = "Default2.aspx"; form1.Controls.Add(hlink);

          D 1 Reply Last reply
          0
          • D darkcalin

            Ok then try this: LinkButton hlink = new LinkButton(); hlink.ID = "ZoneLink"; hlink.Text = "TestButton"; hlink.PostBackUrl = "Default2.aspx"; form1.Controls.Add(hlink);

            D Offline
            D Offline
            danasegaranea
            wrote on last edited by
            #5

            Thanks for the reply darkcalin. The thing is that they have created one user control which gets html tags as input and prints a table. But I I add this to form , my problem is not solved. What I am doing is that creating a control and and rendering its contents to html page. Hope I am clear now

            D 1 Reply Last reply
            0
            • D danasegaranea

              Thanks for the reply darkcalin. The thing is that they have created one user control which gets html tags as input and prints a table. But I I add this to form , my problem is not solved. What I am doing is that creating a control and and rendering its contents to html page. Hope I am clear now

              D Offline
              D Offline
              darkcalin
              wrote on last edited by
              #6

              Try this: :doh: HyperLink hlink = new HyperLink(); System.IO.StringWriter sw = new System.IO.StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); hlink.ID = "ZoneLink"; hlink.Text = "TestButton"; hlink.NavigateUrl = "Default2.aspx"; hlink.RenderControl(htw); Response.Write(sw.ToString());

              D 1 Reply Last reply
              0
              • D darkcalin

                Try this: :doh: HyperLink hlink = new HyperLink(); System.IO.StringWriter sw = new System.IO.StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); hlink.ID = "ZoneLink"; hlink.Text = "TestButton"; hlink.NavigateUrl = "Default2.aspx"; hlink.RenderControl(htw); Response.Write(sw.ToString());

                D Offline
                D Offline
                danasegaranea
                wrote on last edited by
                #7

                This one I have Already tried. The things is that the HyperLink is Not Causing the CrossPage postback. I need cross Page PostBack

                D 1 Reply Last reply
                0
                • D danasegaranea

                  This one I have Already tried. The things is that the HyperLink is Not Causing the CrossPage postback. I need cross Page PostBack

                  D Offline
                  D Offline
                  darkcalin
                  wrote on last edited by
                  #8

                  For moment i don't have any idea. Could you please write more code here to see how can we fix that :wtf:

                  D 1 Reply Last reply
                  0
                  • D darkcalin

                    For moment i don't have any idea. Could you please write more code here to see how can we fix that :wtf:

                    D Offline
                    D Offline
                    danasegaranea
                    wrote on last edited by
                    #9

                    Working on it

                    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