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. A page can have only one server-side Form tag.

A page can have only one server-side Form tag.

Scheduled Pinned Locked Moved ASP.NET
helpsysadmin
8 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.
  • E Offline
    E Offline
    Ersan Ercek
    wrote on last edited by
    #1

    Hello my code causes the above error. I do not understand, I am trying to get htmlcode of the page to send an email. I have no problem, the mail is okay but the page itself can not be opened and gives the above error. The code is as follows: StringBuilder str = new StringBuilder(); StringWriter strw = new StringWriter(str); HtmlTextWriter htmlw = new HtmlTextWriter(strw); this.Render(htmlw); Please help...

    S A OriginalGriffO 3 Replies Last reply
    0
    • E Ersan Ercek

      Hello my code causes the above error. I do not understand, I am trying to get htmlcode of the page to send an email. I have no problem, the mail is okay but the page itself can not be opened and gives the above error. The code is as follows: StringBuilder str = new StringBuilder(); StringWriter strw = new StringWriter(str); HtmlTextWriter htmlw = new HtmlTextWriter(strw); this.Render(htmlw); Please help...

      S Offline
      S Offline
      sashidhar
      wrote on last edited by
      #2

      Ersan Ercek wrote:

      A page can have only one server-side Form tag.

      Its Saying tht They are more than one form tags in your page..! In which page this error is coming..!

      Ersan Ercek wrote:

      I have no problem, the mail is okay

      Then In Email.Is the error is raising?or where? when you are using master page, and in the content page if you use form tag again ,This error causes..!

      LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

      E 1 Reply Last reply
      0
      • E Ersan Ercek

        Hello my code causes the above error. I do not understand, I am trying to get htmlcode of the page to send an email. I have no problem, the mail is okay but the page itself can not be opened and gives the above error. The code is as follows: StringBuilder str = new StringBuilder(); StringWriter strw = new StringWriter(str); HtmlTextWriter htmlw = new HtmlTextWriter(strw); this.Render(htmlw); Please help...

        A Offline
        A Offline
        Abhishek Sur
        wrote on last edited by
        #3

        If you have more than one form tag with Runat=server it will cause error. Actually, aspnet uses server side form element to enforce validation, postbacks etc. If you place 2 server side form it will cause errors. So just remove the form tag which is not required. Also if you want to request for two pages, just place the response directly to a container element rather than adding the whole form to the page again. :-D If it is not clear, let me know.

        Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


        My Latest Articles-->** Simplify Code Using NDepend
        Basics of Bing Search API using .NET
        Microsoft Bing MAP using Javascript

        E 1 Reply Last reply
        0
        • A Abhishek Sur

          If you have more than one form tag with Runat=server it will cause error. Actually, aspnet uses server side form element to enforce validation, postbacks etc. If you place 2 server side form it will cause errors. So just remove the form tag which is not required. Also if you want to request for two pages, just place the response directly to a container element rather than adding the whole form to the page again. :-D If it is not clear, let me know.

          Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


          My Latest Articles-->** Simplify Code Using NDepend
          Basics of Bing Search API using .NET
          Microsoft Bing MAP using Javascript

          E Offline
          E Offline
          Ersan Ercek
          wrote on last edited by
          #4

          First of thank you very much for the answer, however it is not clear enough for me... with container element you mean a table for example? Should I render the table only? Could you please give an example.. Also it depends on the render command, if I do not run it page is displayed wo problem. thx alot.

          modified on Tuesday, November 17, 2009 7:48 AM

          A 1 Reply Last reply
          0
          • E Ersan Ercek

            Hello my code causes the above error. I do not understand, I am trying to get htmlcode of the page to send an email. I have no problem, the mail is okay but the page itself can not be opened and gives the above error. The code is as follows: StringBuilder str = new StringBuilder(); StringWriter strw = new StringWriter(str); HtmlTextWriter htmlw = new HtmlTextWriter(strw); this.Render(htmlw); Please help...

            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #5

            Am I right in thinking this is to do with your earlier question about email and html? If so, then did you add the <form> tag because it complained that the table must be in a form tag? I tried the response you got from sashidar myself and found the same thing. Are you using master pages? Because I assumed that it had something to do with that when I tried it.

            No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones "Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            E 1 Reply Last reply
            0
            • E Ersan Ercek

              First of thank you very much for the answer, however it is not clear enough for me... with container element you mean a table for example? Should I render the table only? Could you please give an example.. Also it depends on the render command, if I do not run it page is displayed wo problem. thx alot.

              modified on Tuesday, November 17, 2009 7:48 AM

              A Offline
              A Offline
              Abhishek Sur
              wrote on last edited by
              #6

              Yes.. You can render only the part of the object you want. Dont render the whole page. Say your html is placed inside a div. Use div.RenderControl to get the content rather than trying this.Render. Is this a problem or recursion? If you render the same page that you are in, it will cause an infinite recursion as well. :thumbsup:

              Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


              My Latest Articles-->** Simplify Code Using NDepend
              Basics of Bing Search API using .NET
              Microsoft Bing MAP using Javascript

              1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                Am I right in thinking this is to do with your earlier question about email and html? If so, then did you add the <form> tag because it complained that the table must be in a form tag? I tried the response you got from sashidar myself and found the same thing. Are you using master pages? Because I assumed that it had something to do with that when I tried it.

                No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones "Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"

                E Offline
                E Offline
                Ersan Ercek
                wrote on last edited by
                #7

                Sorry for late response I hate not to answer somebody who is tyring to help me. But I had a busy day. Yes it is related but no I am not using master page. It is about rendering the page. I am trying to pass the content of current page as email. However when I render the page I receive this error. I think I am close to get rid of this problem with rendercontrol, however when I use it mycode creates a new div instead of getting the info of the existing div. Thanks for help.

                1 Reply Last reply
                0
                • S sashidhar

                  Ersan Ercek wrote:

                  A page can have only one server-side Form tag.

                  Its Saying tht They are more than one form tags in your page..! In which page this error is coming..!

                  Ersan Ercek wrote:

                  I have no problem, the mail is okay

                  Then In Email.Is the error is raising?or where? when you are using master page, and in the content page if you use form tag again ,This error causes..!

                  LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

                  E Offline
                  E Offline
                  Ersan Ercek
                  wrote on last edited by
                  #8

                  NO problem is not with the email it is okay, but when trying to render the page it gives that error.

                  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