Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8906373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:38:13+00:00 2026-06-15T02:38:13+00:00

We are trying to take the HTML from a GridView and store it into

  • 0

We are trying to take the HTML from a GridView and store it into a String so that string can be used a a body of an email.

So far we have used this coding in the code-behind:

Protected Sub EmailStudentList()

    ' Get the rendered HTML.
    '-----------------------
    Dim SB As New StringBuilder()
    Dim SW As New StringWriter(SB)
    Dim htmlTW As New HtmlTextWriter(SW)

    GridViewSummary.RenderControl(htmlTW)

    ' Get the HTML into a string.
    ' This will be used in the body of the email report.
    '---------------------------------------------------
    Dim dataGridHTML As String = SB.ToString()

    MsgBox(Server.HtmlEncode(dataGridHTML))
End Sub

When the application is running this error is displayed:

Control 'BodyPlaceholder_GridViewSummary' of type 'GridView' must be placed 
inside a form tag with runat=server.

so I placed a form tag at this location in the markup:

<asp:Content
    ID="ContentBody"
    ContentPlaceHolderID="BodyPlaceholder"
    runat="server">

<form runat="server">

Now we get this error:

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

There are no other form tags in anywhere else in the markup.

This is the markup for the GridView:

<asp:GridView 
    ID="GridViewSummary" 
    runat="server" 
    AllowPaging="True" 
    AllowSorting="True" 
    AutoGenerateColumns="False">

    <Columns>
        <asp:BoundField DataField="Surname" HeaderText="Last Name" SortExpression="Surname" />
        <asp:BoundField DataField="Forename" HeaderText="First Name" SortExpression="Forename" />
        <asp:BoundField DataField="ParentName" HeaderText="Parents" SortExpression="ParentName" />
    </Columns>

</asp:GridView>      
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:38:16+00:00Added an answer on June 15, 2026 at 2:38 am

    Add following sub in your page and try again:

    Public Overrides Sub VerifyRenderingInServerForm(control As Control)
        Return
    End Sub
    

    Edit:

    To turn off event validation, just add EnableEventValidation=”False” into your aspx page’s directive. For example

    <%@ Page EnableEventValidation="False" %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to setup a html form that will take a file from a
Trying to have a page which will not take everything from layouts/application.html.erb, Is it
I have a command-line process that creates a PDF file from an HTML file
I'm trying to write a program that will take an HTML file and make
Real quick background : We have a PDFMaker (HTMLDoc) that converts html into a
I am trying to take the URLs that are in single HTML paragraphs and
I am trying to take data from a HTML <form> and generate a report
I have a datagridview with 9 columns. I am simply trying take the value
I'm trying to take a multibyte string of Greek characters and trim it down
net I am trying to take a value from a previous form typically in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.