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. Getting HTML string of Panel in codebehind

Getting HTML string of Panel in codebehind

Scheduled Pinned Locked Moved ASP.NET
html
7 Posts 4 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.
  • M Offline
    M Offline
    Milind R Chavan
    wrote on last edited by
    #1

    Hello, I am using a panel control on page. I want a html of the pannel control in codebehind. Thanks in Advance Regards, Milind

    H N 2 Replies Last reply
    0
    • M Milind R Chavan

      Hello, I am using a panel control on page. I want a html of the pannel control in codebehind. Thanks in Advance Regards, Milind

      H Offline
      H Offline
      himanshu2561
      wrote on last edited by
      #2

      Hi, what are you trying to achieve? please clarify

      himanshu

      M 1 Reply Last reply
      0
      • H himanshu2561

        Hi, what are you trying to achieve? please clarify

        himanshu

        M Offline
        M Offline
        Milind R Chavan
        wrote on last edited by
        #3

        I am trying to get HTML containing in the Panel object (the panel is contaning tables and gridview)

        1 Reply Last reply
        0
        • M Milind R Chavan

          Hello, I am using a panel control on page. I want a html of the pannel control in codebehind. Thanks in Advance Regards, Milind

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          milindchavan12 wrote:

          I want a html of the pannel control in codebehind.

          You want the rendered HTML output of the panel, right? Try something like

          public string GetControlRenderedOutput(Control control)
          {
          StringBuilder builder = new StringBuilder();
          StringWriter writer = new StringWriter(builder);
          HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);
          control.RenderControl(htmlWriter);
          return builder.ToString();
          }

          Try passing your panel's object to this method. :)

          Navaneeth How to use google | Ask smart questions

          modified on Monday, June 15, 2009 8:42 AM

          M 2 Replies Last reply
          0
          • N N a v a n e e t h

            milindchavan12 wrote:

            I want a html of the pannel control in codebehind.

            You want the rendered HTML output of the panel, right? Try something like

            public string GetControlRenderedOutput(Control control)
            {
            StringBuilder builder = new StringBuilder();
            StringWriter writer = new StringWriter(builder);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);
            control.RenderControl(htmlWriter);
            return builder.ToString();
            }

            Try passing your panel's object to this method. :)

            Navaneeth How to use google | Ask smart questions

            modified on Monday, June 15, 2009 8:42 AM

            M Offline
            M Offline
            Milind R Chavan
            wrote on last edited by
            #5

            Thank you, It works

            1 Reply Last reply
            0
            • N N a v a n e e t h

              milindchavan12 wrote:

              I want a html of the pannel control in codebehind.

              You want the rendered HTML output of the panel, right? Try something like

              public string GetControlRenderedOutput(Control control)
              {
              StringBuilder builder = new StringBuilder();
              StringWriter writer = new StringWriter(builder);
              HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);
              control.RenderControl(htmlWriter);
              return builder.ToString();
              }

              Try passing your panel's object to this method. :)

              Navaneeth How to use google | Ask smart questions

              modified on Monday, June 15, 2009 8:42 AM

              M Offline
              M Offline
              Milind R Chavan
              wrote on last edited by
              #6

              Ohh Problem .... It is giving me error on control.RenderControl(htmlWriter) line. public string GetControlRenderedOutput(Control control) { StringBuilder builder = new StringBuilder(); StringWriter writer = new StringWriter(builder); HtmlTextWriter htmlWriter = new HtmlTextWriter(writer); control.RenderControl(htmlWriter); return builder.ToString(); } Error : RegisterForEventValidation can only be called during Render();

              B 1 Reply Last reply
              0
              • M Milind R Chavan

                Ohh Problem .... It is giving me error on control.RenderControl(htmlWriter) line. public string GetControlRenderedOutput(Control control) { StringBuilder builder = new StringBuilder(); StringWriter writer = new StringWriter(builder); HtmlTextWriter htmlWriter = new HtmlTextWriter(writer); control.RenderControl(htmlWriter); return builder.ToString(); } Error : RegisterForEventValidation can only be called during Render();

                B Offline
                B Offline
                Baran M
                wrote on last edited by
                #7

                Read this [^]

                You are best person who knows about your problem. ------------------------------------------------- More pain more gain

                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