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 4040806
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:47:58+00:00 2026-05-20T12:47:58+00:00

I’m asking this because I access mails from Exchange Server. The body of the

  • 0

I’m asking this because I access mails from Exchange Server. The body of the mails contains HTML. To display the mails’ body I use a FreeTextBox Control. But I have a lot mails which I firstly show in a gridview. But the problem is the HTML in the body which also is shown in the gridview cells. Is it possible to put a FreeTextBox in each record of the gridview???

Any help is welcome

this is the code I use to bind/etc

    private DataTable dt;
    private ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
    private void Page_Load(object sender, System.EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            dt = new DataTable();
            MakeDataTable();
            ConnectToExchange();
            DoorloopMailbox();
            BindGrid();
        }
        else
        {
            dt = (DataTable)ViewState["DataTable"];
        }
        ViewState["DataTable"] = dt;
        //service.TraceEnabled = true; --om te traceren.

    }

    private void ConnectToExchange()
    {
        service.Credentials = new NetworkCredential("user", "pass", "domain.com");
        service.Url = new Uri("Uri");
    }

    private void DoorloopMailbox()
    {
        FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox,
            new ItemView(100));
        foreach (Item item in findResults.Items)
        {
            item.Load();
            DataRow dr = dt.NewRow();
            dr["OutlookID"] = item.Id.UniqueId;
            //dr["Sender"] = item.
            dr["Subject"] = item.Subject;
            string processedInput;
            string omschrijving = item.Body;
            if (omschrijving != null)
            {
                processedInput = Regex.Replace(omschrijving, @"<(.|\n)*?>", string.Empty);
            }
            else
            {
                processedInput = "geen omschrijving";
            }
            dr["Body"] = processedInput;
            dr["Sent"] = item.DateTimeSent;
            dt.Rows.Add(dr);
        }
    }

    private void BindGrid()
    {
        gvAanvragen.DataSource = dt;
        gvAanvragen.DataBind();
    }

    private void MakeDataTable()
    {
        dt.Columns.Add("OutlookID");
        dt.Columns.Add("Sender");
        dt.Columns.Add("Subject");
        dt.Columns.Add("Body");
        dt.Columns.Add("Sent");
    }

    protected void GvMeldingen_SelectedIndexChanged(object sender, EventArgs e)
    {
        Response.Redirect("Detailscherm.aspx?melder=" + Server.UrlEncode(gvMeldingen.SelectedRow.Cells[3].Text)
            + "&datum=" + gvMeldingen.SelectedRow.Cells[6].Text
            + "&onderwerp=" + Server.UrlEncode(gvMeldingen.SelectedRow.Cells[4].Text)
            + "&id=" + Server.UrlEncode(gvMeldingen.SelectedRow.Cells[1].Text)
            + "&omschrijving=" + Server.UrlEncode(gvMeldingen.SelectedRow.Cells[5].Text));
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
    }

    protected void GvAanvragen_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvAanvragen.PageIndex = e.NewPageIndex;
        BindGrid();
    }

this is the code in designer view:

<asp:GridView ID="gvAanvragen" 
            OnPageIndexChanging="GvAanvragen_PageIndexChanging" runat="server" AllowPaging="True" 
            AllowSorting="True" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" 
            BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" 
            PageSize="5">
            <RowStyle BackColor="#F7F7DE" />
            <FooterStyle BackColor="#CCCC99" />
            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </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-05-20T12:47:59+00:00Added an answer on May 20, 2026 at 12:47 pm

    Yes, you can do this. Use a TemplateField in your gridview, then put the FreeTextBox control inside of your ItemTemplate or EditTemplate (probably just edit template).

    Kind of like this:

            <asp:TemplateField HeaderText="HTML Content">
                <ItemTemplate>
                    <asp:Label ID="lblText" runat="server" Text='<% Eval("") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <FTB:FreeTextBox id="ftbTest" runat="server" Text='<% Bind("") %>' />
                </EditItemTemplate>
            </asp:TemplateField>
    

    EDIT

    Do you even need to use FreeTextBox? Maybe you just need to set HtmlEncode="false" on your BoundField (if your using one). By default the GridView will HtmlEncode all text before displaying it, for security reasons.

    EDIT 2
    Note I set AutoGenerateColumns="false" and added the three columns. I left out the message id, but you can add it back in by adding another BoundField like the ones already there.

    <asp:GridView ID="gvAanvragen" 
            OnPageIndexChanging="GvAanvragen_PageIndexChanging" runat="server" AllowPaging="True" 
            AllowSorting="True" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" 
            BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" 
            PageSize="5" AutoGenerateColumns="false">
            <RowStyle BackColor="#F7F7DE" />
            <FooterStyle BackColor="#CCCC99" />
            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField HeaderText="Subject" DataField="Subject" />
                <asp:BoundField HeaderText="Body" DataField="Body" HtmlEncode="false" />
                <asp:BoundField HeaderText="Sent" DataField="Sent" />
            </Columns>
        </asp:GridView>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
this is what i have right now Drawing an RSS feed into the php,

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.